Jump to content
Changes to the Jaspersoft community edition download ×

How do I specify a date range in the print when expression for elemnets


Go to solution Solved by GilesBruleOutlook.com,

Recommended Posts

I am trying to add a print when expression for an image on a report that is set by date so that if the current date is between x date and y date the image will be printed otherwise it wont. I do this for other types of data but I get all manner of errors when trying to do it with date, I have tried many things but not gotten anywhere, usually it complains that I can't use the > function with a date. What I have been trying is some thing like this

new Date() => new Date (2019-01-01) && new Date() =< new date (2019-02-01)  

I apologize I don't have the exact code I have tried as I am away from my work computer but in any event nothing I have tried has worked so I'm probably way off anyway, any help would be greatly appreciated, thanks

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

Ok, So I figured it out and am posting to help anyone else that comes across this.

new java.util.Date().after (DATE(2019,8,01)) && new java.util.Date().before (DATE(2019,8,02)) 

will do the trick, one note is that you cannot use 08 and 09, for whatever reason they are not allowed and you must use 8 and 9 with out leading zeros for them otherwise its fine to use 01, 02 and so forth.

Link to comment
Share on other sites

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