Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

Delete Variabels via Script

Hi Folks,

i have a question, i use this code:

Temp_Variables:

LOAD

    Name,

    "Definition"

FROM [lib://MyData/Template_Variablen.xlsx]

(ooxml, embedded labels, table is Sheet1);

for i = 0 to NoOfRows('Temp_Variables')- 1

let vName = peek('Name', i, 'Temp_Variables');

let $(vName) = peek('Definition', i, 'Temp_Variables');

next i

and this code does work great and flawless, with this script-code: i import from Excel-spreadsheet all stored variabels into my Qlik Sense App, on the base of this situation i have a question,

is there any code or techniques to delete all variabels per script-code ?


Thanks a lot for your help and feedback

Beck

5 Replies
martinpohl
Partner - Master
Partner - Master

Hello Beck,

the only way is to delete them in the variables overview.

http://help.qlik.com/en-US/sense/June2017/Subsystems/Hub/Content/Variables/delete-variable-using-dia...

If you tant that nobody can see the value of a variable you can set them to null at the end of the script (one by one).

beck_bakytbek
Master
Master
Author

Hi Martin,

thanks a lot for your feedback, i am aware about this option in Qlik Sense, i thought whether is there an option to delete all variables within my app automatically (via script)?

but thanks a lot for your help

Beck

pathiqvd
Creator III
Creator III

Hi,

   Check below thread,

Clear variable since the script

Regards,

beck_bakytbek
Master
Master
Author

Hi Lakshmipathi,

thanks a lot for your help, it does look good, but i am looking for a bit another issue.

Thanks a lot

Beck

beck_bakytbek
Master
Master
Author

Hi Martin and Lakshmipathi,

i created this solution, i know there is a room for improvment,but it does work and it does look like:

Temp_Variables:

LOAD

    Name,

    "Definition"

FROM [lib://MyData/Template_Variablen.xlsx]

(ooxml, embedded labels, table is Sheet1);

/////////////////////////////////////////////////////////Variables will be stored

for i = 0 to NoOfRows('Temp_Variables')-1

let vName = peek('Name', i, 'Temp_Variables');

//let vComment = peek('Comment', i, 'Temp_Variables');

let $(vName) = peek('Definition', i, 'Temp_Variables');

next i

////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////// the content of variables will be deleted ( before i use this code, i comment out the above code, where i store my variables within my app) ///////////

Sub DeleteVariables

for i = 0 to NoOfRows('Temp_Variables')-1

let vName = peek('Name', i, 'Temp_Variables');

let $(vName) = Null();

next i

End Sub;

Call DeleteVariables;

////////////////////////////////////////////////////////////////////////////////

i hope that helps and thanks a lot for your help and feedback

Beck