Menu

Format DateTime parameter in Report Short Description?

ART Help
Brian C
2022-08-19
2022-08-24
  • Brian C

    Brian C - 2022-08-19

    I am using DateTime parameters in my tabular report's short description, but they don't seem to follow any formatting.

    The parameter's Date Format is 'yyyy-MM-dd hh:mm a'.
    The general settings DateTime Format is 'dd-MMM-yyyy HH:mm:ss'

    But, in the short description, I get :: 2022-08-19 00:00:00.000 - 2022-08-19 23:59:00.000 ::

    Is there a way to format this date?
    My Short Description is #countDateTimeStart# - #countDateTimeEnd#

     
  • Timothy Anyona

    Timothy Anyona - 2022-08-19

    Hi,
    The date format settings are not applicable for display in the short description. I believe the default display for a #param# is dd-MM-yyyy HH:mm:ss.SSS. The [Expressions] part of the admin manual should provide some description of modifying the default output. Not very straightforward but here are some samples.

    Using field syntax

    f[datetime|#date1#|dd-MM-yyyy HH:mm]f

    Using groovy syntax

    g[new java.text.SimpleDateFormat("dd-MM-yyyy HH:mm").format(date1.value);]g

    This requires updating the groovy-whitelist.txt file to add the applicable classes i.e.

    java.text.SimpleDateFormat
    art.reportparameter.ReportParameter

     

    Related

    Wiki: Expressions

  • Brian C

    Brian C - 2022-08-22

    Thanks for the info. I had tried using expressions, but the values weren't getting substituted. I notice that my local manual doesn't say expressions work in Short Description, whereas the online manual does. So, I probably need to update to get that functionality.

     
  • Timothy Anyona

    Timothy Anyona - 2022-08-24

    That's true. The functionality was added in a recent release.

     

Log in to post a comment.