danoldenkampgmail.com Posted May 3, 2019 Share Posted May 3, 2019 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 More sharing options...
hozawa Posted May 5, 2019 Share Posted May 5, 2019 How about just checking on day of the week.(WEEKDAY(new GregorianCalendar().getTime(),true) == 6) ? new Date((new Date()).getTime() + (1000 * 60 * 60 * 24)) : new Date((new Date()).getTime() + 3*(1000 * 60 * 60 * 24)) 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