Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

peter_turner
Valued Contributor

Setting a variable from file

Hello All,

I need to figure out how to load some defaults into my variables from a file.

The idea is i have a Defaults.ini file which is tab delimited.
The file has the variable and then the expression i want to store into it.
Some expressions would be just text but others might be functions

So far i have a load of the data

Directory;
LOAD variable,
expression
FROM
Defaults.ini
(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

But now i need to assign the variable with the expression, any ideas?

Thanks,
Peter.

1 Solution

Accepted Solutions
Not applicable

Setting a variable from file

Hi Peter,

Here you are a possible solution.

I hope this help you.

Best regards.

7 Replies
Not applicable

Setting a variable from file

Hi Peter,

Here you are a possible solution.

I hope this help you.

Best regards.

peter_turner
Valued Contributor

Setting a variable from file

Hello,

Thank you for your fast reply.
i would like to replace the var1 with a 'peek' for the variable name instead, but i'm having trouble with the command.

let var1 = peek('Expression', 0, Tvariable ); is OK

I want to change the command to:
let peek('Variable', 0, Tvariable )=peek( 'Expression', 0, Tvariable ); = Script line error.

I have also tryed using the evaluate() function, and Let or Set.

Thanks,
Peter.

Not applicable

Setting a variable from file

Hi Peter,

As far as I know, that is impossible, you can't create / define a variable as result of a expression.

Sorry.

Best regards.

peter_turner
Valued Contributor

Setting a variable from file

Hi Miguel,

I figured a solution out.

I made a new variable called 'var_temp' which will hold the variables name first, then use this to assign the value

let var_temp = peek('Variable', 0, Tvariable );
let $(var_temp) = peek('Expression', 0, Tvariable );

Next for me is to make a loop to read from row 0 to the EOF Smiley Happy

Thanks,
Peter.

Not applicable

Setting a variable from file

Hi Peter,

Smart solution. You've got !!

Best regards.

jbeierschmitt
New Contributor III

Setting a variable from file

I successfully tested this script to support maintaining change control between our development, quality and production environments where an external reference provides the NAS folder reference.

However, for some reason when I attempt to use the exact same script after a binary load it does not appear to function correctly.

Any ideas or suggestions?

Thanks

Jim

jbeierschmitt
New Contributor III

Setting a variable from file

User error - the table I used to create the variables did not get dropped so it was part of the binary load.

Once I dropped that table the script worked.

Community Browser