Comparing Dates

Stimulsoft Reports.WEB discussion
Post Reply
jaked
Posts: 2
Joined: Fri Sep 04, 2015 7:54 pm

Comparing Dates

Post 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))}
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Comparing Dates

Post 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.
Post Reply