10 Replies Latest reply: Mar 17, 2015 11:01 AM by Ryan Liljestrand RSS

    Cleanup in script - set variables to NULL

    Friedrich Hofmann

      Hi,

       

      in principle I am already doing this: Every variable that is being used in a script is afterwards set to NULL so that I won't eventually end up with obsolete variables that can cause confusion in an app.

      I have now a piece of code that loads an Excel_file with the two logons of the developers we have and creates out of those a visibility_condition like

      >> OSUSER() = 'SYNCREON\name.surname OR OSUSER() = 'SYNCREON\name2.surname2'  <<

      Pretty complex stuff. It's basically all being done in a loop which I will post here.

       

      The challenge is: I already do set the variables to NULL, but I still have the evaluations of the variables left when I run that.

      => How can I set those to NULL?

      (  >> SET $(varname) = ; <<  (inside the loop) doesn't work, that would be easy ... )

      This is the loop (the Excel_file is attached)

       

      FOR i = 1 TO $(v_admins) // that is the nr. of rows
        LET varname = 'v_admin' & $(i);
        LET $(varname) = PEEK('OSU', ($(i)-1), Developers_pre); //Developers_pre is the table that I first get when I load the file
        LET varname2 = 'e_admins_only_part' & $(i);
        LET $(varname2) = 'OSUSER() = ' & $(varname);
      // I have exclamation_marks around the individual elements here to avoid confusion with upper_quotes (they are replaced lateron)

        LET e_admins_only = '$(e_admins_only)' & ' OR OSUSER() = ' & chr(33) & $(varname) & chr(33);
      // The variables are now all deleted (set to NULL)

        SET varname2 = ;
        SET varname = ;
      NEXT i;

       

      Can anybody help me here?

       

      Thanks a lot!

      Best regards,

       

      DataNibbler