# \[IGN-6833\] Scripting and expressions consider all view params to be strings

**URL:** <https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 13, 2022, 6:57pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439 "2022-11-13T18:57:25Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Lyon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/adam_lyon/32/41432_2.png) [@Adam\_Lyon](https://forum.inductiveautomation.com/u/Adam_Lyon)\
**Post date:** [November 13, 2022, 6:57pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/1 "2022-11-13T18:57:25Z")

</div>

I am wanting to pass a boolean value to a popup view param, like so..  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/4/8442f6ff332063639f323fb3bdd6822fe2f911ae.png)

I cannot for the life of me figure out what to put in, nothing works.  
I've tried, 'false', 'False', 0, '{false}', '{False}'

The only way I can get this to work is making another view prop called 'permafalse' and passing that in, seems like a dirty way to do this...  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/ac8b5a5d2a42f4a1af512b4ee7bef5b0794cba5a.png)

What is the correct way to do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 13, 2022, 7:02pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/2 "2022-11-13T19:02:58Z")

</div>

Just open the popup through scripting. Or you'll have to use the 2nd option.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 14, 2022, 9:53am UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/3 "2022-11-14T09:53:57Z")

</div>

I just tried and indeed, it seems you can't pass booleans...

I'd do this instead:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e912f36ad78e0bf1de035631b1c222fbbbcf196.png)

Make a custom property, bound to the param, where you check if its value is `"true"`, or `"True"`, or `1`, or whatever you want to use as boolean values.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 14, 2022, 1:11pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/4 "2022-11-14T13:11:34Z")

</div>

> [@pascal.fragnoud](#):
>
> it seems you can't pass booleans

I wonder if this is because of the mismatch between json and python

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 14, 2022, 3:42pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/5 "2022-11-14T15:42:13Z")

</div>

> [@justinedwards.jle](#):
>
> I wonder if this is because of the mismatch between json and python

Doesnt look like it even gets converted to json, its just a string literal or if inbetween {} its trying to get a path

---

<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:** [November 14, 2022, 3:44pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/6 "2022-11-14T15:44:30Z")

</div>

Here are the reasons your previous attempts failed:  
`'false'`: String (always evaluates as `true`)  
`'False'`: String, but now it's upper-case.  
`0`: This is a number, but in theory it should have evaluated as false unless you have a direct comparison\*  
`'{false}'`: This is a String, with brackets around the word "false".  
`'{False}'`: This is a String, with brackets around the word "False", where the "F" has been capitalized.

What you want:  
`false`, with no quotes, not brackets, and the "f" is lower-case. Make sure to hit `Enter` when you're done typing `false` so that the value is properly committed to the field; a common issue when applying values in these fields is that the user does not properly commit the value.

\*The `0` value would fail later evaluation if you have comparisons like this: `{view.params.foo} = "true"` or even `{view.params.foo} = true` because you're doing a direct equality comparison between a numeric value and either a string or boolean value. If you're passing `0`/`1`, you have to allow for them to be evaluated as a boolean value. Supposing a `foo` param value of `0`, you can use the numeric value as a boolean flag as long as you allow code to treat it as such.

```auto
if self.view.params.foo: # 0 will be evaluated as false-y here.
    # do something

```

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 14, 2022, 3:49pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/7 "2022-11-14T15:49:26Z")

</div>

> [@cmallonee](#):
>
> `false`, with no quotes, not brackets, and the "f" is lower-case.

Still getting a unicode  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/054ae02d7d99c18f8907e46a0bdd49c551bda944.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/b/5bd8dc8a7ef16108823e6fee3584cd444f39814a.png)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 14, 2022, 3:53pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/8 "2022-11-14T15:53:41Z")

</div>

Doesn't work.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7d641056c75a513fc668ae96fc5b5b9b4b5fc070.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/348120aa9be12f14f11da105fa290230a3ca3d63.png)

'custom' is bound to 'view.custom.foo'  
'param' is bound to 'view.params.foo'

~~'view.params.foo'~~'view.custom.foo' has this expression binding:  
`{view.params.foo} = "true"`

---

<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:** [November 14, 2022, 4:01pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/9 "2022-11-14T16:01:57Z")

</div>

> [@pascal.fragnoud](#):
>
> 'custom' is bound to 'view.custom.foo'  
> 'param' is bound to 'view.params.foo'
> 
> 'view.params.foo' has this expression binding:  
> `{view.params.foo} = "true"`

That's correct: `{view.params.foo}` will evaluate as `true`, but then you have it bound to a comparison against a string value; since `true` is not equal to `"true"`, it is becoming `false`. Remove your binding on `view.params.foo`.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 14, 2022, 4:06pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/10 "2022-11-14T16:06:54Z")

</div>

I mistyped, the binding is on `{view.custom.foo}`

`{view.params.foo}` does not evaluate as `true`, but as `"true"`, even though the parameter passed was a boolean.

Actually, anything you pass to the `popup` action is interpreted as unicode:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/faf1080e841315dc86c38778d2b8f486d05f1ec6.png)

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

---

<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:** [November 14, 2022, 4:22pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/11 "2022-11-14T16:22:03Z")

</div>

Hmmm. I _am_ seeing some odd behavior as I dive deeper into this. On my end, the value I'm passing is correctly being evaluated as a boolean value, and yet reporting of the type of the value does indeed report as Unicode. I'll look into this a bit more and report back later.

---

<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:** [November 15, 2022, 4:42pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/12 "2022-11-15T16:42:39Z")

</div>

This is a bug on our end. I'll spare you the technical details, but we have an open internal ticket to get it fixed. It's a fairly low priority because it's been this way for... forever, and bindings against these values still work. The primary impact is that direct references (scripting and expressions) view the params as strings.

---

<div class="post-metadata">

**Author:** ![Adam\_Lyon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/adam_lyon/32/41432_2.png) [@Adam\_Lyon](https://forum.inductiveautomation.com/u/Adam_Lyon)\
**Post date:** [November 16, 2022, 1:20pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/13 "2022-11-16T13:20:13Z")

</div>

Thank you everyone for your help with this. Unfortunately, the best solution for my particular use case has been the one I was already using, of simply creating two props, one called peramatrue, the other called permafalse and passing that in. The popup is for either creating or updating a database and is called by 2 different buttons, so this is adequate.

---

<div class="post-metadata">

**Author:** ![Adam\_Lyon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/adam_lyon/32/41432_2.png) [@Adam\_Lyon](https://forum.inductiveautomation.com/u/Adam_Lyon)\
**Post date:** [November 16, 2022, 1:23pm UTC](https://forum.inductiveautomation.com/t/ign-6833-scripting-and-expressions-consider-all-view-params-to-be-strings/66439/14 "2022-11-16T13:23:35Z")

</div>

There are other places in my project that I've needed to do this. Simply evaluating the property as a boolean was failing. Thank you!
