# Range

### Overview

The **Range Filter Component** checks whether a given input data falls within a specified range. If the condition is met, the message is passed through the `inRange` port; otherwise, it is routed to `notInRange`.

### Usage

This component is used to validate whether a text, number, or date is within a predefined range, making it useful for conditional processing in workflows.

#### Properties

| Property       | Type      | Description                                              |
| -------------- | --------- | -------------------------------------------------------- |
| `sourceData`   | `string`  | The data to be checked. Can be a number or date.         |
| `rangeMin`     | `string`  | The minimum value of the range.                          |
| `rangeMax`     | `string`  | The maximum value of the range.                          |
| `exclusiveMin` | `boolean` | If `true`, the minimum value is excluded from the range. |
| `exclusiveMax` | `boolean` | If `true`, the maximum value is excluded from the range. |

#### Input Ports

| Port | Description                                             |
| ---- | ------------------------------------------------------- |
| `in` | Accepts input data and the range values for comparison. |

#### Output Ports

| Port         | Description                                                       |
| ------------ | ----------------------------------------------------------------- |
| `inRange`    | Emits the message if `sourceData` is within the specified range.  |
| `notInRange` | Emits the message if `sourceData` is outside the specified range. |

#### Processing Logic

1. **Receives Input Data**:
   * Accepts a dataset (`sourceData`), minimum (`rangeMin`), and maximum (`rangeMax`) values.
2. **Checks for Range Inclusion**:
   * If both values are numbers, compares them numerically.
   * If both values are dates, checks if `sourceData` falls within the given range.
   * If `exclusiveMin` or `exclusiveMax` is set to `true`, strict range checks are applied.
3. **Routes the Message**:
   * If `sourceData` falls within the range, it is passed to the `inRange` port.
   * Otherwise, it is passed to the `notInRange` port.

#### Output Data Schema

| Property     | Type      | Description                                                    |
| ------------ | --------- | -------------------------------------------------------------- |
| `sourceData` | `string`  | The original data that was checked.                            |
| `rangeMin`   | `string`  | The minimum value of the range.                                |
| `rangeMax`   | `string`  | The maximum value of the range.                                |
| `result`     | `boolean` | `true` if `sourceData` is within the range, otherwise `false`. |

### Notes

* **Supports Numeric & Date Comparisons**: Compares numbers and dates effectively.
* **Configurable Exclusive Boundaries**: Allows users to include or exclude boundary values.
* **Ideal for Conditional Filtering**: Useful in workflows requiring validation of a value within a specific range.

This component is essential for workflows that need to filter or route messages based on whether a value falls within a predefined range.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appmixer.com/connector-configuration/utils/filters/range.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
