2 Replies Latest reply: Jan 27, 2015 5:40 AM by Friedrich Hofmann RSS

    Clean up obsolete variables

    Friedrich Hofmann

      Hi,

       

      I have just had a problem in one of my scripts once again, the reason for which was an obsolete variable, still retained in the app, that I had mistakenly used to build something new. Of course it didn't work and took me a while until I figured this out.

       

      => Is there a way I can build a loop, like I have for cleaning tables in RAM, to clean up all existing variables at the end of a script?

           I have a naming_convention, so it would be a possibility to work with a *. Would that work?

       

      Thanks a lot!

       

      Best regards,

       

      DataNibbler

        • Re: Clean up obsolete variables
          Marcus Sommer

          Hi DataNibbler,

           

          this isn't directly possible within the script because it didn't exists a variable-array through which you could loop. You will need always an additionally step and read all avilable variables with macros (in another variable or a textfile - whereby then you could delete directly) or you read the meta-data from the app and used these information then within the script.

           

          QlikTip #9: Deleting variables via user-interface, within the load-script or by using macros (translated)

           

          - Marcus

            • Re: Clean up obsolete variables
              Friedrich Hofmann

              Thanks Marcus!

               

              Okay - the whole thing is two-fold anyway:

              1) First, it is a one-off job to delete all obsolete variables that are obviously not in use anymore - that can be done via
                   the variable_manager, I have tested that they don't return after a restart.

              2) The second step - what I'm currently doing for this one app - is just going through the script m.o.l. line by line,
                   noting the names of the variables created and then looking for when they have completely done their job and then
                   just insert a command to set them to a NULL value.

              I will do that - it's a lot of work, but getting everything clean and orderly is worthwhile.

               

              Thanks a lot!

              Best regards,

               

              DataNibbler