Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

evaluate a qlikview variable in the loading script

hi,

i define a variable in Qlikview MyVariable with an expression =MyField. For example, MyField have the value "Q1"


when i use this variable in the loading script: SET v=$(MyVariable )

i see in v the value "=MyField" and i would like in v the value Q1.

if someone have a solution to obtain Q1 value in script.

6 Replies
Miguel_Angel_Baeyens

Hello,

Use LET instead of SET:

LET MyVariable = FieldValue('FieldName', Pos);


Hope that helps

Not applicable
Author

thx Miguel

i tried your solution Let MyVariable = FieldValue(MyField,1); MyField has 4 values Q1,Q2,Q3 and Q4. but when i debug the script i see MyVariable NULL

and so i search to have the selected value of MyField therefore i dont know the positon in FieldValue.

Not applicable
Author

and when i define MyVariable in Qlikview with the expression =FieldValue('MyField',1), i obtain Q1. It is strange in the loading script it is null

Miguel_Angel_Baeyens

That was just an example on the use of LET instead of SET.

Take a look at the following script:

SET Variable1 = 'Value'; // Plain Text value stored in variableSET Variable2 = $(Variable1); // Variable2 has now the value content in Variable1


Hope this helps.

Not applicable
Author

if i understand

if you have a variable defined by an expression in QV, you can't have her real value in other variable in the loading script.

for example Variable1 = MyFied and MyField have the value Q1

if you put that in the script :

SET Variable2 = $(Variable1);

Variable2 will have the value =MyField and you can t have Q1.

Not applicable
Author

ok reference manual confirm my sentence

Variables can contain numeric or alphanumeric data. If the first character of a variable
value is an equal sign '=' QlikView will try to evaluate the value as a formula
(QlikView expression) and then display or return the result rather than the actual formula
text.

QV evaluate the formula like the value. 😕