# Perspective Integer found String Expected

**URL:** <https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546>\
**Category:** Ignition\
**Created:** [July 9, 2020, 2:37pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546 "2020-07-09T14:37:20Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyle.lawson](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@kyle.lawson](https://forum.inductiveautomation.com/u/kyle.lawson)\
**Post date:** [July 9, 2020, 2:37pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/1 "2020-07-09T14:37:20Z")

</div>

Hello,

How can I not get an error when an integer is entered on a text field? Currently I am getting an “integer found, string expected” error. Sometimes the user will enter just an integer and other times it will be a string so I figured the text field would be the best option. I can not let the error exist as I use the quality field for another script.

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [May 4, 2021, 1:51pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/2 "2021-05-04T13:51:02Z")

</div>

Facing the same issue. What was weird was that it was working fine and then I started getting the error. Now I can’t seem to get it to stop.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [May 4, 2021, 2:54pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/3 "2021-05-04T14:54:58Z")

</div>

Could you post a screenshot of this issue? There’s a warning in the Designer which can be safely ignored and which has absolutely no impact on the front-end user nor the back-end designer session other than the highlighting of the property.

If for some reason you absolutely must remove the highlighting, you could introduce a change script to convert any integer values to string values:

```auto
self.props.text = str(currentValue.value)

```

Please note that this will result in the value being written twice, and so anything which updates on the value change will happen twice. his is not an issue if something only reads the property. For example, if you introduce a DB write as part of the onChange script, the DB write will occur twice - once with an integer value and then a second time with a string value. If you have bindings which read the property, those bindings will fire twice, once with an integer value and once with a string value. If you have an onClick (or similar event which reads the property value, those will still only evaluate once as the event is fired.

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [May 5, 2021, 11:46am UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/4 "2021-05-05T11:46:42Z")

</div>

All I want to do is enter in 123456 into the text field. The reason for this is that sometimes the employeeid will have a leading zero which they MUST enter in (and I get it that I can concatenate the leading zeros on the backend but management wants them entering it in so that isn’t an option). Point being that Ignition shouldn’t be comma formatting the number in a text field. It is a bug.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/c/bc00d2a6ee9f38d1a7dd6f8be39263253425c2c3.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/1/b151b9cdd064542eb774dd306ec7ca2b87573ae0.png)

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [May 5, 2021, 11:49am UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/5 "2021-05-05T11:49:27Z")

</div>

I appreciate your suggestion, however If it causes the the event to fire twice then I can’t use it as a workaround. I posted the issue below.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [May 5, 2021, 8:10pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/6 "2021-05-05T20:10:34Z")

</div>

> [@tony.petruzzi1](#):
>
> Point being that Ignition shouldn’t be comma formatting the number in a text field. It is a bug.

If you bind a label against that `text` property, you'll see that even the displayed Label value does not contain a comma.  
If you look at the TextField in an active session (or even in the Designer), you'll see that the TextFIeld does not display the comma.  
 ![Screen Shot 2021-05-05 at 1.03.11 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/8/886b72d5d3d707e6c2543c1f224b78d8c089a367.png)  
If you look at the value as it is stored within the view, you'll see that the value does not contain the comma.

```auto
"children": [
      {
        "meta": {
          "name": "TextField"
        },
        "position": {
          "height": 32,
          "width": 150,
          "x": 200,
          "y": 179
        },
        "props": {
          "text": "123456"
        },
        "type": "ia.input.text-field"
      },
      {
        "meta": {
          "name": "Label"
        },
        "position": {
          "height": 32,
          "width": 113,
          "x": 200,
          "y": 231
        },
        "propConfig": {
          "props.text": {
            "binding": {
              "config": {
                "path": "../TextField.props.text"
              },
              "type": "property"
            }
          }
        },
        "type": "ia.display.label"
      }
    ]

```

The comma AND the warning are only visible in the Designer, and will have no impact on your data either as it is displayed or as it is stored.

At this point you might ask, "well why does it have a warning at all if numbers aren't a problem?"

The answer is that the value of a Text Field must ALWAYS be a string, and so we cast whatever value you supply it to be a string on the backend. The _front-end_ however sees only the characters `123456` and the JSON sort of says "hey, those are numbers" and so it tries to display them as numbers. At this point there's a sort of sort of disconnect which leads to what you're seeing. We can't change the schema to allow for numbers because the value must be a string and will be cast to a string. It is better to err on the side of being informative here in case a user tries to save a float/int value because their value would be changed to a string without warning.

---

<div class="post-metadata">

**Author:** ![Aaron\_Ekstrand](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Aaron\_Ekstrand](https://forum.inductiveautomation.com/u/Aaron_Ekstrand)\
**Post date:** [December 16, 2021, 9:53pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/7 "2021-12-16T21:53:14Z")

</div>

I have the same warning on my numeric dropdown, and it also stops the display label from appearing whenever I change the value in the designer—even though the value is changed (and will appear correct if I reload the page).

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 16, 2021, 10:11pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/8 "2021-12-16T22:11:05Z")

</div>

Could you perhaps supply the view.json file in use, or provide some screenshots which demo your issue? I’m able to supply numeric values/options without issue. I can see the same warning if I supply a numeric value for `props.placeholder`, but even that property is working as expected.

 ![Screen Shot 2021-12-16 at 2.09.29 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/2/b252a3b0942fbe99ecb150fd92afe62867f58fbe.png)  
 ![Screen Shot 2021-12-16 at 2.09.36 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/7/27069e8010b50f33ceaa93fb10281535d2e8d1ab.png)

---

<div class="post-metadata">

**Author:** ![Aaron\_Ekstrand](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Aaron\_Ekstrand](https://forum.inductiveautomation.com/u/Aaron_Ekstrand)\
**Post date:** [December 22, 2021, 8:59pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/9 "2021-12-22T20:59:38Z")

</div>

[IntegerDropdownIssueDemonstration.zip](https://forum.inductiveautomation.com/uploads/short-url/lZ79lzBEAHCdDSJRSsYn5c9Qzsn.zip) (3.6 KB)

this should show what I’m talking about ^

lmk if you have any issues importing it

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 22, 2021, 9:17pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/10 "2021-12-22T21:17:03Z")

</div>

Your issue has nothing to do with the contents or values of the properties, and everything to do with the dimensions of the Dropdown. All problems ceased the moment I made your Dropdown a bit bigger, and returned when I went back to the original size. I also don’t see any warnings along the lines of “Integer found String Expected”. As a workaround, please adjust the size of your Dropdown to something just a bit bigger (width), OR you could also set `Dropdown.props.search.enabled` to have a value of `false`. It appears that the culprit is the “search” input moving the selected value out of place, and then not re-allocating the space once a selection is made.

---

<div class="post-metadata">

**Author:** ![Aaron\_Ekstrand](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Aaron\_Ekstrand](https://forum.inductiveautomation.com/u/Aaron_Ekstrand)\
**Post date:** [December 22, 2021, 11:20pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/11 "2021-12-22T23:20:06Z")

</div>

Thank you very much!

It seems that the minimum width for the dropdowns in the page I’m developing is 96 to show 2 digits… seems pretty absurdly wide, tbh.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/b/6bd8cc6b4f2b39495370a1d6109b0f6f7bd3a5d3.png)

Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 23, 2021, 2:20am UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/12 "2021-12-23T02:20:43Z")

</div>

No, it’s just a flaw with the Dropdown (for which I opened an internal ticket). The search input is failing to release the space it occupies when an option is selected. That search input requires x amount of space from the right, and so it sort of pushes text content to the left if there is not enough space. If you inspect the page while this is occurring, you can actually see the selected option label, but it’s off to the left. I bet if you set the overflow of the Dropdown to a value of “visible” you could see the label. Anyway, removing the ability to search bypasses this problem because there is no search input to “push” the label.

---

<div class="post-metadata">

**Author:** ![michael2](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@michael2](https://forum.inductiveautomation.com/u/michael2)\
**Post date:** [December 23, 2021, 3:02am UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/13 "2021-12-23T03:02:57Z")

</div>

> [@\[IGN-5352\] Perspective Dropdown does not display values correctly if the dropdown isn't wide enough](https://forum.inductiveautomation.com/t/bug-perspective-dropdown-does-not-display-values-correctly-if-the-dropdown-isnt-wide-enough/48093/2):
>
> The ones on top are after searching? You can try play with the style overflow tho not sure if it will help. edit after test: Oh i see, once you select an option and then open up the dropdow again it indeed seems to space out to the left. This only seems to happen if search is enabled tho, the text gets pushed to the left so that the cursor is visible in the dropdown

Sounds familiar

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 23, 2021, 4:10pm UTC](https://forum.inductiveautomation.com/t/perspective-integer-found-string-expected/36546/14 "2021-12-23T16:10:11Z")

</div>

Oh, yes, exact same issue. I’ll link that post to the ticket as well.
