• 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.

startup script setting appvar to hide column not working

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

  • startup script setting appvar to hide column not working

    Hello team, I have an interesting issue. I have a behavior in my app that will call a new app into a popup URL widget. I pass a couple of parameters to the new app. One of those parameters is called divNum. It's like a location number. The new app has a startup script that checks for this value and will hide or show a column based on whether it's passed or not. The script looks like it works becasue I have no default value for the appvar in the app when the app loads, I check the developer console and see the value.
    You can see here that divNum is null and hideDivNum is set to false.
    image.png
    However, the column is hidden in the app.
    If I edit that app var and don't change it, just press the save button, it works.
    image.png​
    ​image.png​image.png​
    Any idea why this doesn't work on startup?
    Valence Framework 6.3.20250708.0

  • #2
    You mentioned that you have a "startup script"? Can we see that code?

    Comment


    • #3
      Yep, used the Valence Assistant.

      var divNumValue = getAppVar('divNum');

      if (divNumValue !== null && divNumValue.trim() !== '' && divNumValue.trim() !== '0') {
      setAppVar('hideDivNum', 'true');
      var gridContainer = getWidget('2921');
      gridContainer.filter("RC1DIVN = '" + divNumValue + "'");
      } else {
      setAppVar('hideDivNum', 'false');
      }
      setAppVar('hideDivNum', getAppVar('hideDivNum'));

      success();
      ​
      Like I said, I think it works since that app var doesn't have a default value, and I can see it's not blank in the console.

      image.png​

      Comment


      • #4
        I would suggest the following assuming your goal is to just hide the column if "divNum" is not "empty". Remove the script and place an expression on your "hideDivNum" app variable.

        Code:
        Valence.isEmpty(appVar.divNum) ? false : true

        Comment


        • #5
          That seemed to fix it.
          Why did the script not work?

          Comment


          • #6
            I'd have to debug it to give you a confident answer.

            Comment

            Working...
            X