5 Replies Latest reply: Dec 21, 2013 12:14 PM by Claudio Degli Antoni RSS

    Iter apply cost calendar range date

    Claudio Degli Antoni


      Hi all,

       

      I need to apply for each order the appropriate cost.

       

      For semplicity, attach an easy script with the same logic

      I have 2 table

      The first table (calendar) that contain the date

      The second table (cost) that contain the cost (date-range).

       

      I do this in 4 step.

      I belive that i can obtain the same result in 3 steps with ITER.

      Load Calendar

      Load Cost

      Iter Calendar and apply appropriate cost but i can't find the right way to apply the cost

       

       

      Someone can help me plese:

       

       

      vStart=2013;

      LET vActualYear = year(now());

      LET Start = num(makedate($(vActualYear) ,01,01));

      LET End   = num(makedate($(vActualYear)+1 ,12,31));

      LET NumOfDays = End - Start + 1;

      SET inv=1;

       

      Date_src:

      LOAD

        $(Start) + Rowno() -1 as DataGen

      AUTOGENERATE $(NumOfDays);

       

       

      Calendar:

       

      Load

      num#(Date(DataGen, 'YYYYMMDD'), 'YYYYMMDD') as DataInvoice

      RESIDENT Date_src;

      Cost:

      LOAD * INLINE [
      Data1, Data2, €uro
      20130101,20130630,1000
      20130701,20132131,2000]
      ;

                

      T3:

      NoConcatenate

      LOAD *

      Resident Calendar;

      Left Join

      LOAD *

      Resident Cost;

       

      NoConcatenate

        T4:

      LOAD *

      Resident T3

      where DataInvoice=20130101;

       

      DROP Table Calendar;

      DROP table Cost;

      Drop Table T3;

       

      Exit script;

       

       

      Many Thanks

      Claudio