Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

swegener
New Contributor

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?
Tags (4)
1 Solution

Accepted Solutions
Not applicable

variables in qvd-Files?

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

5 Replies
prieper
Honored Contributor II

variables in qvd-Files?

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

variables in qvd-Files?

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

variables in qvd-Files?

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

variables in qvd-Files?

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
New Contributor

variables in qvd-Files?

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

Community Browser