Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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,
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.
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
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
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
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