Skip to main content
Pentaho Documentation

Date and Time Parameters

This task is only useful for result sets that contain date information. You should also want to do some kind of sorting based on date or time results.

The formula described here will provide a date picker in a report parameter, allowing report users to view data constrained by the specified date and time.

  1. Open an existing report or create a new report and establish a data source and query, then drag your data-driven fields onto the canvas.
  2. Add a new parameter by clicking the Master Report Parameter button at the top of the Data pane. The Add Parameter... dialogue will appear.
  3. Type in an appropriate parameter name and friendly name for the parameter.
  4. In the Value Type field, select or type in Date.
  5. Create a formula for the Default Value Formula. If you want the current date and time to be the default, you can use =NOW() as your formula, or for a slightly more specific output, try =DATEVALUE(DATE(YEAR(NOW());MONTH(NOW());DAY(NOW())-WEEKDAY(Now()))).
    Note: Alternatively, to define a time-related value use the Time Value Type and select the appropriate option under Timezone.

    File:/rd_time_parameter.png

  6. In the Display Type field, select Date Picker, then click OK to create the parameter.
  7. Click Preview and verify that the parameter displays and functions correctly. You may have to adjust your query if it does not produce a testable result set.
Your report's date-based result set can now be manually adjusted by report users.