Greater than or equal to operators for date comparison in Jaspersoft Studio

0

Hi

I am using Jaspersoft Studio 6.1.0. Community version. How to compare dates using greater than or equal to operators? E.g. in iReports I'm able to use the following expression:

$F{Event_Scheduled_Date} >= TODAY() ? "*" : ""

However, when I use th same in Jaspersoft Studio, while running the report I get the following error.

The operator >= is undefined for the argument type(s) java.lang.String, java.lang.String

What syntax should I use to get the results?

Thanks and kind regards,

Aparna

Aparna_MU's picture
Joined: Jul 26 2015 - 11:56pm
Last seen: 2 years 3 months ago

hi,

what is the data type of $F{Event_Scheduled_Date} ?

 

RamaKrishna.B - 4 years 3 weeks ago

data type of  $F{Event_Scheduled_Date}  is java.sql.Timestamp

Aparna_MU - 4 years 3 weeks ago

2 Answers:

0

You've set "$F{Event_Scheduled_Date} " to be a String instead of a Timestemp

hozawa's picture
50973
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 months 1 week ago
1

Problem solved. I could keep the scheduled date as timestamp. But, changed the expression to the following:

$F{Event_Scheduled_Date}.getTime() >= TODAY().getTime() ? "*" : " "

 

This worked.

 

 

Aparna_MU's picture
Joined: Jul 26 2015 - 11:56pm
Last seen: 2 years 3 months ago
Feedback
randomness