2 Replies Latest reply: Sep 3, 2013 3:10 AM by Andy Myers RSS

    Nested Apply Map with If()

    Priyanka Rao

      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 !

        • Re: Nested Apply Map with If()
          Rajesh Vaswani

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

           

          thanks,

          Rajesh Vaswani

          • Re: Nested Apply Map with If()

            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