4 Replies Latest reply: Dec 19, 2016 10:17 AM by ben anderson RSS

    Losing Variable Values Defined in Script

    ben anderson

      Hi,

       

      I'm experiencing an odd issue with variables defined in my Qlik Sense (Enterprise Server 3.0) script. I have two variables defined in my script using temp tables that are dropped after the variables are defined. The definition of the variables looks like this:

       

      LET v = Peek('value', 0, 'tmptable'');

       

      The variable values are populating correctly, but in order to get them to show up in the application I have to run the script and then open the App Overview in another tab. If I open the App Overview in the same tab the variables are not populated. Furthermore, if I start a new session and open the app from the Hub, the variables are not populated. I have to go to the Data Load Editor and run the script, then open the App Overview in a new tab.

       

      I've tried duplicating the app to test if this is an app specific bug, but that didn't change anything. I also moved the variable definition to the end of the script, but that didn't change anything either.

       

      I'm defining variables in the exact same way in other apps without any issues.

       

      Any help or insight is appreciated!

       

      Thanks

        • Re: Losing Variable Values Defined in Script
          Laurent Paume

          Hi,

           

          I had the same issues and it happened when we defined variables in the script and in the app.

           

          I just reloaded the app using the debug mode in order to reset the values in the script. Not a major problem since it's only an issue when in development mode. If you published the app and you don't touch the script part it should be ok.

           

          Regards,

          Laurent.

            • Re: Losing Variable Values Defined in Script
              ben anderson

              Laurent,

               

              Thanks for the reply. I reloaded the app in debug mode and I could see that the variables were calculated correctly in the debugger window, but when I opened the App Overview the variables were not populated in the UI. In order to get the variables to populate in the UI, I have to reload the script in the data load editor and then open the app overview in another tab.

               

              I'm giving up and simply defining the variables in the app. Unfortunately, my client's implementation of Qlik is locked down for everyone but the admins, so it's very difficult to do any testing outside of your own app.

               

              Thanks again for your help.

               

              Ben

                • Re: Losing Variable Values Defined in Script
                  Vladimir Komarov

                  The only reason the variables are not populated after the data reload is that they were not created properly at the first place...

                   

                  Looks like you are using some temp table to get your variable set. What are you doing with this table afterwards?

                   

                  VK

                    • Re: Losing Variable Values Defined in Script
                      ben anderson

                      VK,

                       

                      I've tried both dropping and keeping the temp tables and it doesn't make a difference.

                       

                      The variables appear to be created correctly. The debugger variable output window shows the variables populated correctly every time I run it (about 10 times today). Also, the variables are correctly populated in the app if I reload the script and open the App Overview in a separate tab.

                       

                      The only time the variables are not populated correctly is when I first open the app or reload the script and open the App Overview in the same tab.

                       

                      Thanks,

                       

                      Ben