Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

inowinowski
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
Not applicable

Re: If Statement in Script

First look says, parenthesis issue. Try like:

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

its_anandrjs
Not applicable

Re: If Statement in Script

You can try with the below script like

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