Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
johncaqc
Valued Contributor

Nested IF - Need Help Deciphering

I've been given the task of updating/fixing a dashboard (I did not create) and am stuck deciphering a nested IF statement. It has to do with 2 dates, and what day of the week they fall on, and whether to alter the original date and create a new date, or not, I believe. Can someone look at the statement below and turn it into a word problem so I can understand what the original author was trying to do?

I think it starts out with:

If Creation Date - Request Date < 0.5 ThenRequest Date + 3 Else Request Date + 2) = Sun Then...(and I get lost)

Here is the code:

if(WeekDay((

if(("CREATION_DATE"-"REQUEST_DATE") <.5,("REQUEST_DATE"+3),("REQUEST_DATE"+2)))) = 'Sun', ((

if(("CREATION_DATE"-"REQUEST_DATE") <.5,("REQUEST_DATE"+3),("REQUEST_DATE"+2)))+2),

if (WeekDay(

if(("CREATION_DATE"-"REQUEST_DATE") <.5,("REQUEST_DATE"+3),("REQUEST_DATE"+2))) = 'Sat', ((

if(("CREATION_DATE"-"REQUEST_DATE") <.5,("REQUEST_DATE"+3),("REQUEST_DATE"+2)))+2), (

if(("CREATION_DATE"-"REQUEST_DATE") <.5,("REQUEST_DATE"+3),("REQUEST_DATE"+2))))) AS NEW_REQUEST

Thanks All,

John

1 Solution

Accepted Solutions

Re: Nested IF - Need Help Deciphering

It calculates a new request date NEW_REQUEST. If the difference between CREATION_DATE and REQUEST_DATE is less than half a day, then add three days to REQUEST_DATE otherwise add two days. That yields a new date. If the new date is a Sunday or a Saturday add another two days. Call the result NEW_REQUEST.


talk is cheap, supply exceeds demand
2 Replies

Re: Nested IF - Need Help Deciphering

It calculates a new request date NEW_REQUEST. If the difference between CREATION_DATE and REQUEST_DATE is less than half a day, then add three days to REQUEST_DATE otherwise add two days. That yields a new date. If the new date is a Sunday or a Saturday add another two days. Call the result NEW_REQUEST.


talk is cheap, supply exceeds demand
johncaqc
Valued Contributor

Re: Nested IF - Need Help Deciphering

I knew someone here could figure that out! Thanks Gysbert!

Community Browser