Date parameter

Date Parameters define a default data range to be used in your query, with the start date and end date as placeholders. These parameters are always used in pairs, representing the start and end of a selected time period.

Date Parameter Settings

When creating a Date Parameter, you'll need to configure:

Values

Set the default start and end dates that will be pre-filled in the calendar. These do not restrict what users can select—users can adjust the dates freely.

Defining Default Start and End dates

Naming

  • Display name: The name that will appear in the control UI.

  • SQL name(s): The name to be used in the SQL query to be replaced by the starting and ending date of the selected period.

Using Date Parameters in your SQL Query

After creating the parameter, add it manually to your SQL query using its placeholders:

SELECT * FROM `carto-demo-data`.demo_tables.fires_worldwide
WHERE acq_date > {{date_from}} AND acq_date < {{date_to}}

Once added, the date picker will appear int he right-side panel, allowing users to adjust the range and see the data source update in real time.

Last updated

Was this helpful?