16 Replies Latest reply: Jan 18, 2017 8:02 AM by Avinash R RSS

    My AppMap recode with condition not return correct value.

    Yeo Poh sai

      Hi All



      I have below script with the help from Staffen and HIC which using loop to load multiple raw data , is work fine.



      FOR i=0 TO NoOfRows('FileList_Sales') -1

      LET vFile = PEEK('FileName_Sales', $(i), 'FileList_Sales');

      For each vFileName in FileList('$(vRAWPath)*.txt')

      if(subfield(subfield('$(vFileName)','\',-1),'.',1) = '$(vFile)') then



        FileBaseName() as SOURCE,

        'SALES' as table,

        @50:60T as [date], 

        @10:38T as [COMPANY],

        @307:312T as [grouping],

        ApplyMap('MapGroup_SG',@307:312T) as [GROUP_CLASS_TDS],

        @121:133T as [cost]

      FROM "$(vFileName)" (ansi, fix, no labels, header is 0, record is line); 


      Next vFileName

      next i



      My issue is when i using below script to recode grouping to GROUP_CLASS_3 Is not return correct value.




      LOAD grouping,


          if (SOURCE='Q_DOD_2016',ApplyMap('MapGrouping_SG',grouping),

          if (SOURCE='Q_FCKL09',ApplyMap('MapGrouping_MY',grouping),

          )) as [GROUP_CLASS_3]



      resident sales;



      Hope you can advise me.


      enclosed my QVW