3 Replies Latest reply: Oct 4, 2018 12:37 AM by Mohamed Ilyas Pitchai Mohamed RSS

    ApplyMap() Vs Lookup() - Material Description

    Mohamed Ilyas Pitchai Mohamed

      Hi Folks,

       

      What am I trying to do is, i want to exclude the purchase line items, that are part of material master.

      Like, buyers used to purchase non-stock material repeatedly and over the period, that gets converted as a stock material.

       

      My Tables:

      Materials: Material Master (MATRL_ID, MATRL_DESC)

      Purchase: Purchases (MR_DTL_MATRL_DESC)

       

      I have used Lookup to see, if the description matches with that of a stock item and it works fine.

      if(isnull(Lookup('MATRL_DESC','MATRL_DESC',MR_DTL_MATRL_DESC,'Materials')),0,1) AS MR_DTL_IS_MATRL,

       

      Since ApplyMap is faster than Lookup, i'm trying to achieve the same using below code, but not working:

       

      Materials:

      LOAD MATRL_ID, MATRL_CD, MATRL_DESC,

      MATRL_GROP_CD, MATRL_GROP_NAME, MATRL_GROP_CATGRY

      FROM $(tQvd_Path)Materials_t.qvd (qvd);

       

      MapMatrlDesc:

      Mapping Load MATRL_DESC, MATRL_ID

      FROM $(tQvd_Path)Materials_t.qvd (qvd);

       

      Purchase:

      Load

      /*if(isnull(Lookup('MATRL_DESC','MATRL_DESC',MR_DTL_MATRL_DESC,'Materials')),0,1) AS MR_DTL_IS_MATRL,*/

      if(ApplyMap('MapMatrlDesc',MR_DTL_MATRL_DESC,0)>0,1,0) AS MR_DTL_IS_MATRL, ...

      FROM $(tQvd_Path)MA_MATRL_REQST_t.qvd (qvd);


      I even added pre and post concatenations to make it unique, like, 'aa' & matrl_desc & 'aa', while loading and in applymap. Nothing worked.

       

      Would appreciate your insights.

       

      Regards

      Ilyas