Clarity

  • 1.  Relative Periods in Jaspersoft Reports

    Posted Nov 04, 2016 06:59 PM

    We are trying to transition our users from the OOTB Crystal Reports to the same, related Jaspersoft Reports.

     

    One of the challenges with the transition is in the date for reports, like the 'Capacity vs. Demand by Resource' report, where the filtering criteria offers both a Specific Date (useful for Adhoc reports) and Relative Date selection - useful for scheduling reports to compile on a recurring basis without having to manupilate the date parameters.

     

     

    I was wondering if there is a relative-date parameter filter object that has been created that would simply need to be included in the OOTB reports Options for a Start Date, if this would need to be scratch-built, or if versions of PPM later than 14.3 that we are currently running (with Jaspersoft Reports 6.2.1) upgrade the OOTB report filtering options to include relative dates.

     

    Thanks in advance,

    Will Lloyd

     

    #jaspersoftreport



  • 2.  Re: Relative Periods in Jaspersoft Reports

    Posted Nov 09, 2016 06:08 AM

    Hi Will,

    I am not sure whether recent jasper upgrade is having this feature rolled out to OOTB reports or not. But i have modified one of our custom reports date parameters to relative date with out much modifications.

    In order to get Relative dates to work we would need to have class of date parameter as "net.sf.jasperreports.types.date.DateRange", and in query we need to use this parameter as '

    $X{LESS, sysdate, relative_date_Parameter}

    '

    Above modifications require much efforts in case of complex query reports.

    So to reduce efforts i have followed below workaround.

    1. Take copy of existing OOTB/Custom report

    2. Create a new parameter with class type as 'net.sf.jasperreports.types.date.DateRange'

    3. Default existing parameter (java.util.Date type) with this new parameter(relative type) value. (so that selected relative date would go into query).

    4. In order to default parameter to today's date or any relative date, in the default value of New Parameter (relative one), give value as "

    new net.sf.jasperreports.types.date.DateRangeBuilder.DateRangeBuilder("DAY+1").toDateRange()

    "

    5.Remove existing date parameter, and configure new parameter in place of existing one with same name.

     

    It should work like existing report. User has to enter input format as 'DAY','WEEK','MONTH','DAY-1',etc... to get the relative dates while scheduling.

     

    Hope this helps.

     

    Regards

    Naveen



  • 3.  Re: Relative Periods in Jaspersoft Reports

    Posted Nov 09, 2016 05:53 PM

    Thanks very much Naveen and Robert.



  • 4.  Re: Relative Periods in Jaspersoft Reports

    Posted Nov 09, 2016 08:42 AM

    For the addition of relative date capability, as appropriate, for out of the box reports, please vote up Use relative Time Period filters in CA provided Jaspersoft reports.