paris11 Posted May 9, 2012 Share Posted May 9, 2012 In my report, I have 2 parameters (start-date and end-date).By default I would like to fill parameters like that "start -date = 'current date - 1 month' ", "end-date 'current date - 1 day' " to select datas of the rolling month.It's easy to do that by SQL, but I would like to do that on Jasper in the definition of the parameter .It seems a lot more difficult in Jasper Is anybody there to help me? please Link to comment Share on other sites More sharing options...
mike.atkinson Posted April 22 Share Posted April 22 This gets me close ... but no cigar. It is basically a series of nested expression. It beaks when crossing the year. I'm working on that now. But ... Not a Programmer. So I use the brute force method (Try this, try that, search the web some more, try something else, lather rinse repeat.) new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("January")?"January": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("February")?"February": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("March")?"March": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("April")?"April": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("May")?"May": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("June")?"June": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("July")?"July": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("August")?"August": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("Septebmer")?"September": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("October")?"October": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("November")?"November": new String(new SimpleDateFormat("MMMM").format(java.util.Date.parse((MONTH(NOW( ))-5) + "/1/" + YEAR(NOW())))).equals("December")?"December":"-" 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