Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

datanibbler
Esteemed Contributor

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
MVP
MVP

Re: Cleaning up variables

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

15 Replies
bruno_montenegr
Contributor 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.

datanibbler
Esteemed Contributor

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?

MVP
MVP

Re: Cleaning up variables

Try like:

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

datanibbler
Esteemed Contributor

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.

datanibbler
Esteemed Contributor

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?

MVP
MVP

Re: Cleaning up variables

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

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.

datanibbler
Esteemed Contributor

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!

datanibbler
Esteemed Contributor

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