1 Reply Latest reply: Jun 22, 2017 8:57 AM by Marcus Sommer RSS

    Problem with a variable: Script Line Error

    Christian Schmitz



      I want to achieve a Variable which is giving me the calendarweek +1 week, e.g. this week is 201725 so I want to have an output of 201726,


      my first idea was to make it with an if-statement:


      LET vL.ActualCalenderWeek= left(WeekName(now()),4) & right(Weekname(now()),2);



      LET vL.NextCalenderWeek2= (if(right($(vL.ActualCalendarWeek)+1,2)=52 or right($(vL.ActualCalendarWeek)+1),2)=53,(left($(vL.ActualCalendarWeek),4)+1)&'01',$(vL.ActualCalendarWeek)+1);


      This did NOT work. I am getting a Script Line Error:


      Script line error:

      LET vL.NextCalenderWeek2= (if(right(201725+1,2)=52 or right(201725+1),2)=53,(left(201725,4)+1)&'01',201725+1)


      My second idea is working:



      LET vL.NextCalendarWeek= if(match(right($(vL.ActualCalendarWeek),2),52,53),(left($(vL.ActualCalendarWeek),4)+1)&'01',$(vL.ActualCalendarWeek)+1);



      BUT I really would like to know, where my mistake is?


      Thanks for any advice,