10 Replies Latest reply: Mar 14, 2018 12:16 AM by Karan KN RSS

    how to merge two flags

    Karan KN

      Can someone help me, how to merge two flags (DateFlag and Flag fields) refer highlighted red text.

       

      Script:

      T1:

      LOAD *,

      IF(MonthDiff >= 1 AND MonthDiff <= 12, 'Flag1',

      IF(MonthDiff >=13 AND MonthDiff <= 36, 'Flag2',

      IF(MonthDiff >=37 AND MonthDiff <= 60, 'Flag3','New'))) AS DateFlag

      LOAD *,

      IF(ISNULL(Max_Sales_Date) = -1, 'Null', ((year(Sales_Date)*12)+month(Sales_Date)) - (((year(Max_Sales_Date)*12)+ month(Max_Sales_Date)))) AS MonthDiff

      Resident Temp;

      DROP Table Temp;

       

      T2:

      LOAD

      C_ID,

      P_ID,

      Sales_Date,

      Max_Sales_Date,

      MonthDiff,

      DateFlag,

      If(WildMatch(DateFlag,'New'),

      If(C_ID = Previous(C_ID), 'Flag1', 'New')) as Flag

      Resident T1 Order by C_ID, Sales_Date, P_ID;