Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Luminary
Luminary

Re: Multiply applymap and IF – Results in variable

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

Re: Multiply applymap and IF – Results in variable

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

Re: Multiply applymap and IF – Results in variable

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

Re: Multiply applymap and IF – Results in variable

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

Re: Multiply applymap and IF – Results in variable

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