While Displayr already has mechanisms for putting date controls on pages, in this article you will see how to do so without having to write any code.
A data set with a Date variable.
- Select the output(s) you want to filter.
- Then go to Anything > Filter > Control > Date Filters on Output. Any date variables in your document will be displayed for you to choose from.
- Choose the date variable you want to use in the filter and click OK
- If you selected any outputs that can't take filters, the message below will pop up. Click OK to clear the message. You may need to take alternate steps to filter the items that can't accept filters directly, such as filtering their source data instead:
Displayr will create a new filter variable in the Data Set tree and apply it to all of the outputs you selected in step 1:
To add the filter to other outputs, select the filter in the Inputs > FILTERS & WEIGHT > Filter(s) menu for each output.
The automation also adds two date selection boxes at the top left of the page:
Changing the date range
To change the date range, which changes the data included in the filter, do the following:
- Click on either the From or To box or both boxes depending on which date you want to change.
- Select the desired start and/or end date from the calendar that pops up. In this example, I chose January 1, 2016 as my start date.
Please note that currently the date controls only accept dates formatted as YYYY-MM-DD. If you'd like to suggest alternative date formats, please email our support team: firstname.lastname@example.org