1 Reply Latest reply: Feb 8, 2018 8:00 AM by Sunny Talwar RSS

    Rolling Number for Calendarweeks in Script

    Christian Schmitz



      I am having two Year Week Fields with the Format YYYYWW and with the following script I have identified the Min and the Max Year.


      left(min([kick-IN]),4) as minDate
      left(max([kick-OUT]),4) as maxDate 
      Resident opportunity_table; 

      LET vL.VarMinDate = Num(Peek('minDate', 0, 'Temp_Date'));  // 2015
      LET vl.VarMaxDate = Num(Peek('maxDate', 0, 'Temp_Date'));   // 2019



      Now I would like to generate for each year (2015-2019) all existing calendarweeks, I know that 2015 has 53 weeks and the other years just 52 weeks AND start from 201501 with a rolling number (1) till the end of 201952 (261).


      Does anybody have an idea how to script this, maybe with a for loop with if condition?


      Thx for your help!