# getRange

A Range model is a data model that represents a range (min and max) for a numerical column. It is suitable for displaying certain *headline* or *scorecard* visualizations, but it also makes it way easier to build a UI-based range slider for filtering.

## **Usage**

```typescript
const formula = await dataSource.getRange({
    column: 'column_A',
    // + base options...
});
```

## **Options**

The `getRange` model inherits all options from the [base options](https://docs.carto.com/carto-for-developers/reference/carto-widgets-reference/models/..#model-base-options), plus:

```typescript
export interface RangeRequestOptions extends BaseRequestOptions {
  column: string;
}
```

* **column:** the name of the column that you will request the range for. Must be a numerical column.

## **Response**

A `rows` list containing a single data object with two values: the `min` and `max` values for the requested column.

```typescript
type RangeModelResponse = {min: number; max: number};
/* example response 
  {min: -1, max: 1300},
*/    
```

The response can be then mapped to any HTML element such as a range slider for filtering.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-178281c1618488a8d11e02de6a0a0ef4bb4506d5%2FScreenshot%202024-10-07%20at%2020.03.58.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>
