Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

chriys1337
Contributor

Problem with a variable: Script Line Error

Hi,

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,

Chris

1 Reply

Re: Problem with a variable: Script Line Error

Maybe this is an alternatively:

LET vL.ActualCalenderWeek= Year(now()) * 100 + Week(now());

LET vL.NextCalenderWeek2= Year(weekstart(now())-1) * 100 + Week(weekstart(now())-1);

- Marcus

Community Browser