Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello experts!
I'm trying to create a variable in the data load editor using 'let', but after I load the data I can't find it in the Variable Panel. The objective of this variable is to load a long and repetitive If statement string and the field from the table is just one cell value.
I'm loading the table and then creating the variable:
table:
load
Expression1
from Expressions.xlsx;
let vExpressionSales = fieldvalue('Expression1', 1);
Thanks in advance
Hi, I would solve this a bit differently. So, I imagine your excel looks something like this:
and with this script:
Expressions:
LOAD
"Variable Name" as var,
Expression
FROM [lib://DATA/Expressions.xlsx]
(ooxml, embedded labels, table is Sheet1);
FOR i = 0 TO NOOFROWS('Expressions')
LET v_var = PEEK('var',$(i),'Expressions');
LET [$(v_var)] = PEEK('Expression',$(i),'Expressions');
NEXT i;
DROP TABLE Expressions;
you can get script generated variable list, that looks like this:
Hi MEBG93
Please check this solution and let us know if this solves it for you.
https://community.qlik.com/t5/New-to-Qlik-Sense/How-to-use-variables-in-load-scripts/td-p/873663
Kind regards...
Hi, I would solve this a bit differently. So, I imagine your excel looks something like this:
and with this script:
Expressions:
LOAD
"Variable Name" as var,
Expression
FROM [lib://DATA/Expressions.xlsx]
(ooxml, embedded labels, table is Sheet1);
FOR i = 0 TO NOOFROWS('Expressions')
LET v_var = PEEK('var',$(i),'Expressions');
LET [$(v_var)] = PEEK('Expression',$(i),'Expressions');
NEXT i;
DROP TABLE Expressions;
you can get script generated variable list, that looks like this:
Thanks!!