Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Hello,
Use LET instead of SET:
LET MyVariable = FieldValue('FieldName', Pos);
Hope that helps
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.
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
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.
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.
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. 😕