# 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.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-7d342c1b75e79121af20e9be03c6c6fbd62214ff%2Fimage.png?alt=media" alt=""><figcaption><p><em>Defining Simple Slider Values</em></p></figcaption></figure>

* **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.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-cb9cdd0478553403fb4ef412a8ec8e7622cde84a%2Fimage.png?alt=media" alt=""><figcaption><p><em>Defining Range Slider Values</em></p></figcaption></figure>

* **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**

```sql
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**:

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-411160cf7a4473ee3d45934d746a663c56498e9b%2Fimage.png?alt=media" alt=""><figcaption><p><em>Control UI for a Numeric Parameter using Simple Slider</em></p></figcaption></figure>

**Range Slider**

```sql
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**:

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-b2a679869c4df4361fd20bfefab49db9db6c3171%2Fimage.png?alt=media" alt="" width="296"><figcaption><p><em>Control UI for a Numeric Parameter using Range Slider</em></p></figcaption></figure>
