Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If Statement in Script

Hi,

     I have a variable 'vCurrentWeekStart' that gives me the start of the current week (Thursdays). It gives me the correct date on any day except for Thursday. On Thursday's, the variable gives me the start date for the previous week not the date of the current Thursday. I was wondering if it were possible to write an if statement in the script that would add 7 days to the vCurrentWeekStart on a Thursday.

if(WeekDay(Today()='Thu', vCurrentWeekStart=vCurrentWeekStart+7, vCurrentWeekStart)

This does not work and I was wondering if there was another way to get a similar result.

Kind Regards,

Isabel

2 Replies
tresesco
MVP
MVP

First look says, parenthesis issue. Try like:

if(WeekDay(Today())='Thu', vCurrentWeekStart=vCurrentWeekStart+7, vCurrentWeekStart)

its_anandrjs

You can try with the below script like

if( WeekDay(Today()) = 'Thu', $(vCurrentWeekStart) = $(vCurrentWeekStart) + 7, $(vCurrentWeekStart) )