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

rolling month by default in a report


paris11

Recommended Posts

 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

  • 11 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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