Jump to content
We've recently updated our Privacy Statement, available here ×

Need help with comparing date fields using iReport


purplepride1961

Recommended Posts

Hello

I'm a newbit to iReports.  I'm using version 5.6.0

I have a need to compare a string field that has dates (in MM/DD/YY format, like 01/09/2020 or a value of 'Missing' , look at the date and see if its more than 6 days old (from today, or the report date), and if so, change the

font on the field.  For now, i'm actually just comparing the date to todays date and if its before today, to change the font.  If I can get it to work , then I'll add the criteria to look back 6 days.

My thought was to create 2 variables. 

The first is called TEMP1, and is set as java.util.date using the variable expression below.  I'm basically setting the character string 'Missing' to a dummy date, otherwise just use the date.

$F{Scheduled Home Delivery}.trim().equals("Missing")? ("12/31/2049") : $F{Scheduled Home Delivery}

My second variable is just called RptDt, is set as java.util.date and has the variable expresssion:  Its meant to contain todays date

new SimpleDateFormat("MM/DD/yyyy").format(new Date())

But I am getting this error: Error processing report - Error evaluating expression for source text: $V{tempSchdHomeDelvDt}.before $V{RptDt}

I am using the following logic to help set a style for a field:

$V{tempSchdHomeDelvDt}.before $V{RptDt}

Any suggestions?

Thank you.

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...