4 Replies Latest reply: May 1, 2017 1:11 PM by kushal chawda RSS

    How to get all months that fall between two dates.

    Niket Sahu

      How to get all months that fall between two date/Month.

      For eg. in below screen shot EMP Id =1, is associated with two month 1 (Jan) and 6 (June).

       

      Desired Output should be like :

       

         

      TEST2.EmpIdTEST2.Month1TEST2.Monttname_final
      11Jan
      12Feb
      13Mar
      14April
      15May
      16Jun
      24Apr
      32Feb
      33March
      34April
      35May

       

       

      Below is the code i have used so far, but stuck with the month range part.Kinldy help

       

      MonthDetails:

      LOAD * INLINE [

          Month, MonthName

          1, Jan

          2, Feb

          3, Mar

          4, Apr

          5, May

          6, Jun

          7, Jul

          8, Aug

          9, Sep

          10, Oct

          11, Nov

          12, Dec

      ];

       

      MLoad:

      Mapping Load Month,MonthName Resident MonthDetails;

       

      TEST:

      LOAD *,SubField(WDate,'/',2) as 'Month1',

      ApplyMap('MLoad',SubField(WDate,'/',2)) as Monttname_final

       

      INLINE [

          Emp Id, Dept, WDate

          1, Admin, 1/1

          1, Store, 3/6

          2, HR, 2/4

          3, Infra, 15/2

          3, Store, 5/5

      ];