Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I'm a newbie to Qlik environment and am using Qliksense.
I have a requirement wherein I need to lookup values in each column from a table with multiple columns. I tried having the load statement inside a FOR loop and using variables as shown in the code below:
The columns (fields) in the table "temp" are stored in the field 'concat1' in the table "test2". The columns to be used for mapping are "App Seg3" in table "temp" and "Application 5" in table "test2" (both of which have same values).
The tables are somewhat like this
Test2:
Concat1 | Application 5 |
---|---|
aaa | 1 |
bbb | 2 |
ccc | 3 |
Temp:
App Seg 3 | aaa | bbb |
---|---|---|
1 | xxxx | wwww |
2 | yyyy | vvvvv |
3 | zzzz | uuuu |
I want to add new-column field in test 3 with the output looking as below
Concat1 | Application 5 | new-column |
---|---|---|
aaa | 1 | xxxx |
bbb | 2 | vvvv |
aaa | 2 | yyyy |
The sample code I've written to start with. This is not getting executed when I click "Load Data" button in data editor. Also, I think, I'm reloading test2 multiple times which should not be done. Can you please suggest on how to do this?
Let vNoOfRows = NoOfRows('concat1');
test3:
FOR i=0 to $(vNoOfRows)-1
SET vRecordID = fieldvalue('concat1',$(i));
LOAD
*,
Lookup('$vRecordID','"App Seg3"',"Application 5",'temp')AS Auto_T1
RESIDENT test2;
DROP table test2;
Next i;
Thanks a lot!
Regards,
Aravind (dudeinred1)