Adding a Date/Time Stamp to Scheduled Output

When you add a parameter named _ScheduledTime to a JRXML report design in Jaspersoft iReport Designer, and then schedule the report to run in the server, the output includes a date/time stamp showing when the report ran. The following procedure describes how to set up and use this parameter:

To display the date/time that the report ran:

1. Launch iReport, and open an existing report.
2. In the Report Inspector, right-click Parameters, and select Add Parameter.
3. Rename the parameter _ScheduledTime.

The new parameter appears in the report inspector:

_ScheduledTime Parameter in the Report Inspector

4. Set the following parameter properties:
     Parameter Class = java.util.Date
     Use as a prompt = unchecked

_ScheduledTime Parameter Properties

5. Drag the _ScheduledTime element from the Report Inspector to a valid location, such as the header, in the Designer:

Report Design Includes the _ScheduledTime Parameter Element

6. Now you can set other properties, such as the text color of the date/time stamp. In Properties, check Blank when Null to prevent the word null from appearing on the report when it runs unscheduled.
7. Compile the report, and add it to the server as a report unit. For more information about how to add the report unit to the server, see Adding a Simple Report Unit to the Server.
8. In the server, schedule the report to run immediately.
9. Open the output file:

Output Showing the Scheduled Time the Report Actually Ran

The date and time the report actually ran appears in the output.

Feedback
randomness