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

Help Please..Correct syntax for using Today

I am new to Qlikview and trying to understand the 'Today' syntax using an If statement. The goal is to find the number of days open from Today's date - ClaimNotifyDate. 

if (ClaimStatus = F , StatusDate-ClaimNotifyDate ,$(=today() - ClaimNotifyDate)) as 'Days Open',

I am receiving this error message: Error in expression:')'expected

Thanks..

1 Solution

Accepted Solutions
danielact
Contributor III

Re: Help Please..Correct syntax for using Today

How often is this reloaded? I don't know if the values in the script get updated if it's not reloaded. If it's reloaded every day, there's no need for a variable.

You also don't need the dollar sign expansion. Just use your original expression (assuming the other fields are formatted properly as dates) -

if (ClaimStatus = F , StatusDate-ClaimNotifyDate , Today() - ClaimNotifyDate) as 'Days Open'

3 Replies
oscar_ortiz
Valued Contributor

Re: Help Please..Correct syntax for using Today

I would create a variable for the Today() function in the laod script:

LET vToday = Today();

For the expression i believe you had your ClaimNotifyDate field in the same expression as today function.

if (ClaimStatus = F , StatusDate-ClaimNotifyDate ,$(=today() - ClaimNotifyDate)) as 'Days Open'

if (ClaimStatus = F , StatusDate-ClaimNotifyDate ,$(vToday)-ClaimNotifyDate) as 'Days Open'

Something to worry about here is that you want to have your date fields recognized as date fields.  So you still may have issues returning proper data and that;s most likely due to the format of the date fields you have.

Good luck

Oscar

danielact
Contributor III

Re: Help Please..Correct syntax for using Today

How often is this reloaded? I don't know if the values in the script get updated if it's not reloaded. If it's reloaded every day, there's no need for a variable.

You also don't need the dollar sign expansion. Just use your original expression (assuming the other fields are formatted properly as dates) -

if (ClaimStatus = F , StatusDate-ClaimNotifyDate , Today() - ClaimNotifyDate) as 'Days Open'

Not applicable

Help Please..Correct syntax for using Today

Daniel,

Thanks for providing the correct answer. To answer your question regards to reloading the data, currently I am reloading it, its not currently scheduled. Once scheduled it will probably be weekly.

Thanks.

Community Browser