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 functions.

To do this:

  1. In the places where you are able to specify a value for the parameter, you may see the calendar button . Click this button and the Calendar dialog is displayed. See the dialog.
  2. 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.

  3. JReport's built-in Date/Time formula functions are available for inserting into your expression. To make use of them, click to display the functions. Then click the required function to insert it where the cursor is located in the expression.
  4. The Preview box calculates the result of the current expression. If the expression is not correct, an error message will be shown in the Preview box. Each time you modify the expression, you can click in the Preview box to refresh the result.
  5. When done, click OK to add the value.

See also Calendar dialog for additional help about the options in the dialog.

When running reports via URLs, you can use expressions to specify date and time parameter values too. The format is Parameter_Name={"exp":"Complete_Expression_String", "SelectedDate":"'MM/dd/yyyy"}. If the expression does not contain the function SelectedDate(), there is no need to add this part - "SelectedDate":"'MM/dd/yyyy" and the format is Parameter_Name={"exp":"Complete_Expression_String"}. For example, to specify p_EndDate=today(), write it as p_EndDate={"exp":"today()"}. The following is an example of running the CustomerAnalysis.cls:

http://localhost:8888/jinfonet/runReport.jsp?jrs.cmd=jrs.web_vw&jrs.catalog=%2fSampleReports%2fSampleReports.cat&jrs.report=%2fSampleReports%2fCustomerAnalysis.cls&jrs.param$P_StartDate=01/01/2010&jrs.param$p_EndDate={"exp":"today()"}&jrs.result_type=8