Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Champion
Champion

Cleaning up variables

Hi,

I am always trying to keep my QlikView_apps slim and tidy and understandable for outsiders.

One thing that has been bothering me is variables that are not needed anymore or are not even part of the code anymore, but that have been created at some time or other and are still around there.

=> Is there any way to delete variables after they have been used?

Thanks a lot!

Best regards,

DataNibbler

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: Cleaning up variables

Goto edit script->Settings(tab - the left bottom)->Check 'Can Execute External Programs'

View solution in original post

15 Replies
Highlighted
Creator III
Creator III

Re: Cleaning up variables

Hello.

Yes, you can delete variables that you won't need anymore. Just use:

Set variable = ;

There's one caveat. It only work for variables that were created for the first time in the script. If the variables are already in the Variable Overview, you'll need to delete them there first.

Regards.

Highlighted
Champion
Champion

Re: Cleaning up variables

Thanks Bruno!

I'll try that out immediately. Can I also clean up files (qvd) that I have created in the process?

Highlighted
MVP
MVP

Re: Cleaning up variables

Try like:

Execute CMD.EXE /C del "qvdname.qvd";

Highlighted
Champion
Champion

Re: Cleaning up variables

Hi tresesco,

that sounds promising. I was supposing you could do some cool things with that EXECUTE command, but honestly I'm not good at working in the command line.

Thanks a lot!

I'll try.

Highlighted
Champion
Champion

Re: Cleaning up variables


Hi tresesco,

I am getting an error that the command may not be executed because I don't have the access_rights. I wonder why - the file I want to delete is on the QlikViewServer which I have RW access to.

Do I have to specify the complete file_path? I guess I do ...

P.S.: Well, I still got the error, but this time round I clicked on OK and the command was executed anyway. Of course there's no way I can manually execute the script in the time_interval we need and click on OK at this point every time.

=> Is there any way I can pass something like the /f (force) option?

Highlighted
MVP
MVP

Re: Cleaning up variables

Goto edit script->Settings(tab - the left bottom)->Check 'Can Execute External Programs'

View solution in original post

Highlighted

Re: Cleaning up variables

Yes, you have to specify a path to every QVD (you can use variables to make that more flexible). Otherwise, the reload engine will try to find those QVD's in the directory where the QVW model resides (User Documents), or where you were after the last Directory; script statement.

Highlighted
Champion
Champion

Re: Cleaning up variables

Hi tresesco,

that worked.

I got a dialog_field once, but now it seems the script runs without asking.

Thank you!

Highlighted
Champion
Champion

Re: Cleaning up variables


O_O - I still get that dialog_window and have to confirm that I want to run the script with access to external files ...