Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
stallfelipe
Partner - Contributor II
Partner - Contributor II

How to read and write variables from external file?

I have a qlikview application with a few sliders to control variable values.

How do I make my sliders read/write the variable values from/to an external file?

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

// First load the variables from an external source, in this example, an xls file.
Variables:
LOAD Varname,
     Varvalue
FROM
Variables_Input.xls
(biff, embedded labels, table is MyVars1$)
;

// Process each row of the Variables table
FOR i = 0 to NoOfRows('Variables')-1
LET vVarname = peek('Varname',$(i),'Variables');
LET $(vVarname)=peek('Varvalue',$(i),'Variables');
NEXT i
// Clean up temp script vars
SET i=;
SET vVarname=;

DROP TABLE Variables; // No longer need table 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

// First load the variables from an external source, in this example, an xls file.
Variables:
LOAD Varname,
     Varvalue
FROM
Variables_Input.xls
(biff, embedded labels, table is MyVars1$)
;

// Process each row of the Variables table
FOR i = 0 to NoOfRows('Variables')-1
LET vVarname = peek('Varname',$(i),'Variables');
LET $(vVarname)=peek('Varvalue',$(i),'Variables');
NEXT i
// Clean up temp script vars
SET i=;
SET vVarname=;

DROP TABLE Variables; // No longer need table 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

stallfelipe
Partner - Contributor II
Partner - Contributor II
Author

Thanks for the reply,  

How about writing back to the external file?

I was looking for a solution that also wrote the variable value back to the external file when the sliders are changed by the user.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Writing to the file system from QlikView Server UI is challenging.  In QV Desktop you can use a macro attached to a button. Not sure if you could do that from a QV Server app. It's been a while since I've worked with QV Server.

-Rob

marcus_sommer

Did you consider the use of bookmarks to enable the users to store their (variable)-selections?

- Marcus