Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

leocattqv
Contributor

On Time v Overdue

Hi Everyone,

I am trying to calculate Records by comparing Today is Greater than (Less Than) a due date.  this is what I have, but Im getting errors.

Any suggestions?

if(Today()) > [Calculated Eval Due], 'Overdue', 'OnTime' as EVAL_ONTIME;

1 Solution

Accepted Solutions

Re: On Time v Overdue

try

if(Today() > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

6 Replies
jpapador
Valued Contributor

Re: On Time v Overdue

Check your syntax:

if(Today() > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

should look like that, moved the ) from today to end of if statement

qliknerd
New Contributor III

Re: On Time v Overdue

Hi Leo

you to need to close your if statement:

if(Today()) > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;





Re: On Time v Overdue

Can you check that [Calculated Eval Due] is a correctly formatted date?

The simplest way is to add the field to a listbox and see if the values are shown as dates or numbers, and whether  the data is left or right justified.

If shown as a date, but right justified, the value is correctly held as a dual field and will match the data returned by today()

If shown as a date but left justified, then the value is held as text and you will need to use something like

     Date(date#([Calculated Eval Due], 'DD/MM/YYYY'))  

replacing DD/MM/YYYY with your actual date format to convert the data to a correct date value.

If shown as a number then date([Calculated Eval Due]) should convert the data to a correct date format.

leocattqv
Contributor

Re: On Time v Overdue

Thanks guys,

I appreciate it, but it looks like the comma between [Calculated Eval Due] and 'Overdue' is the hangup.

if(Today()) > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

I apologize for the newbie question but this is stumping me.

thanks,

-L

Re: On Time v Overdue

try

if(Today() > [Calculated Eval Due], 'Overdue', 'OnTime') as EVAL_ONTIME;

leocattqv
Contributor

Re: On Time v Overdue

that did it,

thanks everyone.

Community Browser