Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested Apply Map with If()

Hi,

I have a scenario with nested ApplyMap(), something like;

               Temp_1:

               Mapping Load

               A,

               A_Fetch

               resident Temp;

               Temp_2:

               Mapping Load

               B,

               B_Fetch

               resident Temp;

                                        ...and so on...

               Tab:

               ...

               ApplyMap('Temp1',A1,AppyMap('Temp2',B2, ..)) as New_Field

               ....

Now a field 'New_Field', resultant of  nested ApplyMap() should be created with the logic that

if A_Fetch is NotNull Then A_Fetch values will be taken

and if A_Fetch ISNull Then Go to next ApplyMap of Temp2..Check the same and so on..

Please help in this...

Thanks in advance !

2 Replies
rajeshvaswani77
Specialist III
Specialist III

if(not(isnull(ApplyMap('Temp1',A1)),ApplyMap('Temp1',A1),if(not(isnull(ApplyMap('Temp2',A1)),ApplyMap('Temp2',A1)))

thanks,

Rajesh Vaswani

Not applicable
Author

Morning,

I have just used something similar yesterday. I used the following in my script:

ApplyMap('MAP_CUST_INV',

  COMPANY & '-' &

  REFERENCE_NUMBER,

  ApplyMap('MAP_SUP_INV',

  COMPANY & '-' &

  REFERENCE_NUMBER,

  Null())) as [%Ref Key],

As far as I know this automatically takes into account the null values. If the first map results in a null() it will use the second map, if the second map results in a null it will just return null in this case but you could just as easily put more maps in there.

Andy