Jump to content
We've recently updated our Privacy Statement, available here ×
  • Can relative timestamp be used for reporting on a 15, 10, or 5 minute scale instead of days


    stasp
    • Version: v6.4.2 Product: JasperReports® Library

    The relative dates (or relative timestamps) do not allow specifying a time frame less than a day at the moment. What you can try instead is create a parameter with an expression like this: 

    new Date(System.currentTimeMillis()-15*60*1000) 

    and then use this parameter in report query. This expression will return a timestamp for current time minus 15 minutes (where 15 is minutes, 60 is seconds and 1000 is milliseconds). You can also create a separate parameter for the number of minutes and use it in the expression, e.g.: 

    new Date(System.currentTimeMillis()-$P{minutes}*60*1000) 

    Then you can create an input control for $P{minutes} and users will be able to specify the number of minutes. Also in this case make sure that the $P{minutes} parameter is defined first, and the parameter with the expression above is defined afterwards., because the parameters are initialized by JasperReports engine in the same order they are defined.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...