Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiply applymap and IF – Results in variable

Hi! In my script I have one line with many nested IFs and Applymap.

Can I put the results in a variable to use few lines below in another IF statement?

// Fjalar

if(ApplyMap('Map_Facility',ApplyMap('Map_OrderInfo', %Key_Voucher_Light,%Key_Order))='IRA','SE', if(Applymap('Map_Country',ApplyMap('Map_CustCountry',ApplyMap('Map_Customer',ApplyMap('Map_SuppInvoice',ApplyMap('Map_OrderInfo', %Key_Voucher_Light,%Key_Order)))))=1, if(ApplyMap('Map_CustCountry',ApplyMap('Map_Customer',ApplyMap('Map_SuppInvoice',ApplyMap('Map_OrderInfo', %Key_Voucher_Light,%Key_Order))))='SE','SE','EU'),'Non EU')) as TESTToRegion,

5 Replies
simondachstr
Luminary Alumni
Luminary Alumni

A variable can only hold one value and can not be an array unfortunately. You could technically create a string of results separated with a delimiter but this can become messy if you have many "results". Instead I suggest you to use the peek() function on the table where TESTToRegion is loaded.

Not applicable
Author

Hi,

you may use peek() to get values from previous rows.

It is difficult knowing not your entire case, but have you considered to join instead of those all if and applymap?

regards

Darek

Not applicable
Author

Hi Dariusz!

Yes I have considered to join.  I'll probably try that, keeps the script cleaner.  Not sure how peek kan help me because I have to use the value from current row.

Thanks
// Fjalar

Not applicable
Author

you told:

Can I put the results in a variable to use few lines below in another IF statement?

so, few lines below use peek() to get results from previous line....

regards

D

Not applicable
Author

Misunderstanding!

Can I then use the peek function like this to get the value from TESTToRegion?

IF(Peek('TESTToRegion')='SE','Sweden','Not Sweden') as PeekTEST,

I have never used peek before

// Fjalar