Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
swegener
Contributor II
Contributor II

variables in qvd-Files?

  • Is it possible to store variables in qvd-Files in order to read their values later?
  • How could that be accomplished?
1 Solution

Accepted Solutions
Not applicable

Finally I did it,

In this example variables are loaded from an inline table, but from a qvd this is the same:

tables_variables:
LOAD * INLINE [
Variable_name, Variable_value
asterix, smart
obelix, big
idefix, fast
];


for i=0 to noofrows('tables_variables')-1
LET var_name= peek('Variable_name',i,'tables_variables');
LET $(var_name) = peek('Variable_value',i,'tables_variables');
next i

Just reload and ... Tada ...

View solution in original post

5 Replies
prieper
Master II
Master II

Why not?

Should be a script like the below (not tested):

LET sMyVariable = 'TEST';
VarTable: LOAD $(sMyVariable) AS TableField AUTOGENERATE 1;
STORE VarTable INTO .\VarTable.qvd;


HTH
Peter

Not applicable

And when you want to read that information you can use either


peek(TableField,0)
or
FieldValue(TableField,1)


Those should return the field value so you can use it.

Not applicable

And maybe you could create a qvd with variable name and variable value.

In this case you could have more than one variable in your qvd file... Indifferent

After when you load it you do a loop to retrieve all variables names and values...

To test, but I think that should work...

No I don't have an example for the time being, But I will try that tomorrow...

Not applicable

Finally I did it,

In this example variables are loaded from an inline table, but from a qvd this is the same:

tables_variables:
LOAD * INLINE [
Variable_name, Variable_value
asterix, smart
obelix, big
idefix, fast
];


for i=0 to noofrows('tables_variables')-1
LET var_name= peek('Variable_name',i,'tables_variables');
LET $(var_name) = peek('Variable_value',i,'tables_variables');
next i

Just reload and ... Tada ...

swegener
Contributor II
Contributor II
Author

Thanks for your solutions. They will help me to solve the problem. But they also show me that there seems to be no way to just copy variables and their values from a qvw-File to a qvd-File and from there to another qvw-File. I will have to convert variables into internal tables.

Greetings,

S. Wegener