Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I want to use an if statment store in a table in a load script.
Example :
My Table Source
ID | IFSTATMENT
1 IF(CODE=C2,'A','B')
2 IF(CODE=C1,'C','D')
Target TABLE
CODE | ID | VALEUR
C2 1 A
C2 2 D
How generate the target table ?
I have tryed with an Lookup function but the result is
CODE | ID | VALEUR
C2 1 IF(CODE=C2,'A','B')
C2 2 IF(CODE=C1,'C','D')
What is the syntax for QLIKVIEW interpreter the if statment ?
Thanks !
try this:
iftbl:
Mapping LOAD * INLINE [
ID,F1
1,"IF(CODE=C2,'A','B')"
2,"IF(CODE=C1,'C','D')"
];
LOAD *, Evaluate( ApplyMap('iftbl',ID)) as ifexpr;
load * INLINE [
CODE, ID
C2,1
C2,2
];
What is the aim for the target-table? What do you want to do?
- Marcus
In fact, I recovers the rules of calculation of indicators from a configuration file because the rules change regularly.
ex : Monday : If(Code='A',1,0)
Thursday If(Code='A',5,0)
And i want to generate automatically the rules in my Load Script
HI
Try with Mapping and ApplyMap concept for solve your requirement
But you have already this if you loaded your "My Table Source".
try this:
iftbl:
Mapping LOAD * INLINE [
ID,F1
1,"IF(CODE=C2,'A','B')"
2,"IF(CODE=C1,'C','D')"
];
LOAD *, Evaluate( ApplyMap('iftbl',ID)) as ifexpr;
load * INLINE [
CODE, ID
C2,1
C2,2
];
"My Source Table" is loaded with values of config file !
I want execute the IF statement on the load of my Target table!
Thanks Dariusz it works !!!