Friday, February 8, 2013

Jaspersoft Server Report Units - Passing the date/time formats at runtime to change the display format of date values

  • Create a report unit in Jaspersoft Server.
  •  Add 2 parameters     
    • parameter1 – Date value
1
1.      








    • parameter2- The Date format required to format the “parameter1”
Note: The formats which we can use here are only formats supported by java.text.SimpleDateFormat class.

e.g:        EEEE, dd MMMM yyyy HH:mm:ss zzzz
MM/dd/yy
dd/MM/yy
dd-MMM-yy
yyyy.MM.dd.HH.mm.ss
E, dd MMM yyyy HH:mm:ss Z



 
·     



  •    Now we need to drag and drop the “parameter1” value to the report Detail band and click on its parameters. Find the property called “Pattern Expression” and set “$P{parameter2}” as the value.






  • Now save the report and upload the file successfully to the jaspersoft server.
  • Define a report and run it (Either with default values or change the values).

No comments: