Previous Page Next Page
Using Built-in Functions to Set Date and Time Parameter Values
For a parameter of the Date, DateTime, or Time type, you can customize a dynamic date and time value by creating an expression using built-in formula functions. For example you might want the start date to always be 7 days ago and the end date to be today, you can then customize the value for the start date parameter as dateadd('d', -7, today())
and today()
for the end date parameter.
To specify a date and time parameter value using built-in functions:
- In the places where you are able to specify a value for the parameter, you will see the calendar button
. Click this button and the Calendar dialog appears.

- The Template drop-down list on the right provides some predefined expressions for you to use. You can customize your own expression either based on an existing template or by directly editing the contents in the Expression text box.
If you cannot see the Template label on the right, click >> on the bottom left corner.
- JReport's built-in Date/Time functions are available for inserting into your expression. To make use of them, click
and the Expression dialog appears.

- The top text box shows the current expression statement. Expand the Date/Time node below, double-click the required function to insert it where the cursor is located in the expression. Upon finishing, click OK to return to the Calendar dialog.
- The Preview box calculates the result of the current expression. Each time you modify the expression, you can click in the box to refresh the result. If it is an invalid expression, an error message will be shown in the box and no change will be made to the calendar and the currently selected date/time will be remained in the calendar.
- When done, click OK to add the value.
Previous Page Next Page