Numeric parameter

Numeric parameters are replaced by a single or a pair of numeric values in your query. They are a good choice if you need to filter your data by specific range or calculate analysis based on numeric values.

Numeric Parameter Settings

When creating a numeric parameter, there are a few settings to be defined:

Values

Choose your preferred slider and scale type, be it simple or range for slider type, and discrete or continuous for scale, to optimize data collection according to your needs.

  • Simple Slider: Allows for the selection of a single numeric value.

    • Min Value: The smallest value a user can select.

    • Default Value: The initial value that is presented when the parameter is first used.

    • Max Value: The largest value a user can select.

  • Range Slider: Enables the selection of a pair of numeric values, defining a range.

    • Min Value: The smallest value within the range a user can select.

    • Max Value: The largest value within the range a user can select.

  • Scale: Determines the selection scope and type on a slider, which can be either continuous or discrete.

    • Continuous: Allows unrestricted selection of any value within a defined range.

    • Discrete: Permits selection from specific values within a range, controlled by a "Step Increment" that defines the interval between selectable values.

Naming

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

  • SQL name(s): The name(s) to be used in the SQL query to be replaced by the control UI value(s).

Using Numeric Parameters in your SQL Query

Once the parameter is created, we should manually add it (using its SQL name) to one or more of your SQL Query data sources.

Simple Slider

SELECT ST_BUFFER(geom,{{buffer_size}}) as geom 
FROM carto-demo-data.demo_tables.newyork_newjersey_ooh_panels

After adding the parameter to your SQL query data sources, the control UI will appear in the right-side panel, allowing users to define a custom numeric value:

Range Slider

SELECT * FROM carto-demo-data.demo_tables.riskanalysis_railroad_accidents
WHERE highest_speed_reported >= {{highest_speed_from}} AND highest_speed_reported <= {{highest_speed_to}}

After adding the parameter to your SQL query data sources, the control UI will appear in the right-side panel, allowing users to define the min and max pair of numeric values:

Last updated