luca.frisetti Posted December 17, 2013 Share Posted December 17, 2013 How can I get the yesterday's date with Expression Editor in JSS 5.5, without write Java code ? Link to comment Share on other sites More sharing options...
elizam Posted December 17, 2013 Share Posted December 17, 2013 You can use relative dates. I think in this case it is DAY - 1.See here for a wiki article on relative dates:http://community.jaspersoft.com/wiki/how-use-relative-dates-jrxml-static-reports Link to comment Share on other sites More sharing options...
luca.frisetti Posted December 18, 2013 Author Share Posted December 18, 2013 Thanks, but it isn't exactly what I want ... because I should write anyway code, and I can't do it directly to the Expression Editor. I found a way writing this expression DATE(YEAR(TODAY( )),MONTH(TODAY( )),DAY(TODAY( ))-1), but isn't there a concise way ? maybe similar to EDATE(TODAY( ),-1) that give the possibility to have the previous month. Link to comment Share on other sites More sharing options...
Massimo Rabbi Posted December 20, 2013 Share Posted December 20, 2013 Hi Luca,I think you can open a request for new "feature" on the tracker. We will create something similar to EDATE.Anyhow, for now you could use DateRange stuff.Taken this DATERANGE functions examples: - DATERANGE("DAY-1").getStart() will return 12/19/13 12:00 AM- DATERANGE("DAY-1").getEnd() will return 12/19/13 11:59 PMYou could use something like this: DAY(DATERANGE("DAY-1").getStart())It's the first and quickest solution I can think of.However, please open the issue on the tracker, also referring to this discussion.Thanks.Best regards,Massimo. Link to comment Share on other sites More sharing options...
Massimo Rabbi Posted December 20, 2013 Share Posted December 20, 2013 I just forgot to say, that if it's something you need to use often, you can create a "User Defined" expression from the "Preferences > Jaspersoft Studio > Editors > Expression Editor > User defined expressions". Then whenever you will open the Expression Editor you will be able to put it, just double clicking on the dedicated entry in the node "User Defined Expressions". Massimo. Link to comment Share on other sites More sharing options...
john.v.little Posted August 29, 2014 Share Posted August 29, 2014 DAY(DATERANGE("DAY-1").getStart()) does not work (at least with JS 5.6 on windows) It gives the error "java.lang.ClassCastException: java.lang.Integer cannot be case to java.util.Date Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now