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

Default the Date 1 day, but 3 days for Friday


Recommended Posts

This is a common scenario for report for most places that only work 5 days a week.

I would love to have the report default a parameter to the next day (current date +  1 day) except on Friday's to add 3 days  (so it defaults to Monday).

In SQL you might do this with case statement: 

    when to_char(current_date, 'Dy') = 'Fri'
    then field = current_date + interval '3 day'
    else field = current_date + interval '1 day'

 

In Java, you might default a date 3 days out with something like:

Date nextday = new Date(today.getTime() + (1000 * 60 * 60 * 24));
Date monday = new Date(today.getTime() + 3(1000 * 60 * 60 * 24));

int TodayDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
              // check if it is Friday(Day=6)
              if ((dayOfWeek == 6)  {
                 return monday;
              }
          return nextday;

 

 

Anyone know how to do this in Jaspersoft Expression editor?

In expression editor to return next day, but on Friday return 3 days out?

 

 

 

Link to comment
Share on other sites

  • Replies 1
  • 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...