Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Store variables outside of QV and how to retrieve back into Macro?

Hi

I would like to know if it's possible and if so how to:

store variables outside of QVW file and retrieve it back in the Macro?

My macro runs stored procedures and it needs to connect to a database.  Since i have to switch between Test and Prod env often, can I store the vDBString, vDBUser, vDBPwd outside of the qvw's macro into say a text file, then when I run the macro have it read these values back from the text file?

thanks

Louise

2 Replies
fkeuroglian
Partner - Master
Partner - Master

Yes you can

see the attached, use this to export and import variables to a xls using macro

good luck

Fernando

Not applicable
Author

Hi Fernando,

thanks for the confirm that it's possible to get variables from xls (or for that matter, text file).  the confirmation reminded me as long as I can load the script that includes the text or excel file which defines my variables and values, then I can establish such variables in Qlikview, then in my macro i can just use the variables.  Below is what I have created:

//TEST DB Connection String, this portion is saved in text file for the script to load in first

set vDBString = 'MyDBStringInfo';

set vDBUser = 'MeUser';

set vDBPassword = 'MePassword';

this portion is the macro:

vDBString = ActiveDocument.Variables("vDBString").GetContent.String

vDBUser = ActiveDocument.Variables("vDBUser").GetContent.String
vDBPwd = ActiveDocument.Variables("vDBPassword").GetContent.String

thanks

Louise