Page 1 of 1

Comparing Dates

Posted: Fri Sep 04, 2015 8:34 pm
by jaked
I am having trouble comparing system variables as dates. Basically I have two variables dx1c and dx10c. I need to display one of them depending on some date logic. The date logic is as follows:

if the df(date from) is before 10/01 and the dt (date thru) is after 10/1 I need to choose dx1c.
if the df is after 10/01 I need to choose dx101c
if the dt if before 10/01 I need to choose dx1c

What I have currently doesn't work. Any suggestions?

{IIF ((PoC.dt >= "10/01/2015" && PoC.df <= "10/01/2015"),PoC.dx1c, IIF ((PoC.df >= "10/01/2015"), PoC.dx101c,PoC.dx1c))}

Re: Comparing Dates

Posted: Mon Sep 07, 2015 6:24 am
by HighAley
Hello.

You are trying to compare Date with string. It is not right.
Please, use next expression instead of the "10/01/2015"

Code: Select all

new DateTime(2015, 1, 10)
You could get more information about this constructor on the MSDN Library.

Or as a way maybe it will be simpler for you to create a variable with Date type and us it in the expression instead of the "10/01/2015" string.

Thank you.