Reply
Frequent Visitor
Posts: 5
Registered: ‎11-13-2018
Accepted Solution

IF Statement Help - Greater than less than days overdue

[ Edited ]

Hello Community,

I am trying to output a value to a custom column that is based on greater than x but less than x days over due.

Formula

 

if Duration.Days(DateTime.LocalNow() - [Date Due])>=1 and [Date Due]<7 then "1-7" else null

Error

Expression.Error: We cannot apply operator < to types Number and DateTime.
Details:
Operator=<
Left=7
Right=20/08/2014 23:00:00

 

Any help would be much appreciated!

Thanks, Mark


Accepted Solutions
Highlighted
Super User
Posts: 866
Registered: ‎06-23-2016

Re: IF Statement Help - Greater than less than days overdue

[ Edited ]

you basically need same comparison as you do for 1, right now you compare [Date Due] which is datetime type (when converted to numeric it's 40k+) with numeric 7

if Duration.Days(DateTime.LocalNow() - [Date Due])>=1 and Duration.Days(DateTime.LocalNow()-[Date Due])<7 then "1-7" else null

View solution in original post


All Replies
Highlighted
Super User
Posts: 866
Registered: ‎06-23-2016

Re: IF Statement Help - Greater than less than days overdue

[ Edited ]

you basically need same comparison as you do for 1, right now you compare [Date Due] which is datetime type (when converted to numeric it's 40k+) with numeric 7

if Duration.Days(DateTime.LocalNow() - [Date Due])>=1 and Duration.Days(DateTime.LocalNow()-[Date Due])<7 then "1-7" else null
Frequent Visitor
Posts: 5
Registered: ‎11-13-2018

Re: IF Statement Help - Greater than less than days overdue

That worked perfectly. Thank you!