In this article
The Calendar control, available in the Visual Component toolbox, enables the report viewer to filter the report on dates.
The following is an example of how you could provide a calendar control on a report page so the viewer can filter the data based on a date. In this case, the control will display the response data from respondents who started the interview after the date selected by the viewer in the Calendar control. You can of course use other date data from the Data Source (for example Interview End or from a date-related question), and the appropriate valid expression, to achieve the result you require. The button that is included on the page allows the viewer to refresh the table and chart after they have changed the input date. Proceed as follows:
- Create a new parameter (go to Parameters Overview for more information) and rename it p_interview_start.
- Base the parameter on the Interview Start data component. To do this, double-click on the parameter to open the hierarchy and drag Interview Start from the Data Source toolbox and drop it into the filter folder.
- Right-click on the parameter in the Report toolbox and select Properties.
- Click the down-arrow beside the Type field to open the drop-down list, then set the parameter Type to Date response.
- Open the Page Editor for the page on which you wish to place the Calendar control, drag a Calendar control from the Visual Components toolbox and drop it into the appropriate place on the page.
- From the Report toolbox, drag the parameter you have created and drop it onto the Calendar control.
- In the Filters toolbox, right-click on the Filters folder and select Insert Filter Expression (go to Filter Expressions for more information).
- Type the expression below into the Expression field. On completion click Validate to check that you have typed it correctly.
- Return to the report page and add an aggregated table. Build the table such that it contains data appropriate to the calendar control so you can test and see the results (go to Table Designer Overview for more information).
- Connect the filter to the table (go to the table's Properties page, click the Filters button and select the filter you have created here).
- Drag a button from the Visual Components toolbox and drop it onto the page so you can refresh the page after changing the date control.
interview_start < PValDate("p_interview_start")
You can now add some data to the project, then Preview the page and check that the data displayed changes depending on the date you select in the date control .
Figure 1 - Example of a report page with a Calendar control filter