Jump to content

Comparing a Date to Date with Integer Offset


ktrinad

Recommended Posts

By: Amanda Gellhouse - agellhouse

Comparing a Date to Date with Integer Offset

2003-04-03 18:36

I need to use the following formula to determine whether a graphic is printed or not:

date1 < date2 - dayOffset

 

Where date1 is a Date field in the report, date2 is a Date parameter, and dayOffset is the number of days as an Integer parameter.

 

I have tried a number of variations in the Print When Expression field, but can't find one that works. Does anyone have any suggestions? Or perhaps a custom class with this functionality?

 

Thank you!

 

 

 

 

By: Giulio Toffoli - gt78

RE: Comparing a Date to Date with Integer Offset

2003-04-04 02:36

First af all, in the printWhenExpression you must put something like this:

 

new Boolean( EXP )

 

now, if you date fields are of type java.sql.Date, you can write something like this

 

new Boolean( $F{myDate1}.after($F{myDate2}) )

 

if your date as Long, you can do...

 

new Boolean( $F{myDate1}.longValue() < $F{myDate2}.longValue() )

 

I hope this helps you

 

Giulio

 

 

 

 

By: Amanda Gellhouse - agellhouse

RE: Comparing a Date to Date with Integer Offset

2003-04-09 18:36

Thanks for the help!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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