• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Setting app var to false from script VS setting from a Set App Variables behavior

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting app var to false from script VS setting from a Set App Variables behavior

    Hello, I was having a problem with one of my apps (things were hiding/showing when they weren't supposed to) and was able to narrow it down to setting an app variable to false from a script. The root of the problem seems to be that setting an app variable like like 'setAppVar('myAppVar', 'false');' from a javascript script results in the app variable being stored as a string 'false' value rather than a boolean 'false' value.

    Here is a basic app that demonstrates the problem. The app has just one section, one app variable, one grid, and two buttons. The app variable is 'showBtn' with an initial value of 'true'. The on click of the 'Press to Hide' button will set the 'showBtn' app variable to 'false' from a script. The 'Is This Btn Displayed' has the 'Link To App Variables' Hide set to the inverted value of the 'showBtn' app variable. If you launch this app, you will see the grid and the two buttons like you should, but when you click the 'Press to Hide' button nothing happens. Clicking that button should have hidden the 'Is This Btn Displayed' button. If you look at the NAB Developer Console, you can see that the 'showBtn' is false. If press the pencil icon to edit the value of the app variable from the NAB Developer Console and press Save without changing anything, then the 'Is This Btn Displayed' button immediately hides like it was supposed to.

    If I change the 'Press to Hide' on click behavior to set the app variable to false without using a script, there is no issue either.

    This happens in version 6.3.20250910.0 as well as previous versions. Thanks!


    image.png?image.png?image.png?image.png?image.png?

  • #2
    Want to discuss this one internally. Not sure I would classify this as a bug necessarily as setAppVar is doing what you are telling it to do (set to string "false"). I understand that this works differently on the RPG side (and in the Dev Console) where we assume that "false" or "true" is meant to be boolean.

    If you want to do this via a script you need to use a true boolean.
    Code:
    setAppVar('showBtn',false)

    Comment


    • #3
      Oops, you are totally right. Thank you very much. My bad!

      Comment

      Working...
      X