---
agentTools:
  projectIndex: https://payment-orchestrator.readme.io/llms.txt
---

# Conditional Operators

These operators are used by Conditional Rules to perform comparisons between an input field value and a value expectation.

## Available Operators

### `eq` (*equals*)

The `eq` or *equals* operator asserts that an input *i* is exactly equal to the expectation *e*  (*i = e*).

#### Example

For an hypothetical workflow containing the rule:

```json Workflow
// (...)
{
  "type": "Conditional",
  "field": "amount",
  "operation": "eq",
  "value": 200,
  // (...)
}
// (...)
```

And the workflow execution input:

```json
{
  "amount": 300
}
```

The condition `amount eq 200` would be `false` since `200 ≠ 300`.

***

### `in` (*in*)

The `in` operator asserts that an input *i* is present in array e (*i ∈ e*). It expects an array of values in the `value` field.

The data type of these values needs to comply with the data type defined in the respective scope. As an example, if the `amount` field is set as `Numeric`, then the array may only contain numeric values.

#### Example

For an hypothetical workflow containing the rule:

```json Workflow
// (...)
{
  "type": "Conditional",
  "field": "amount",
  "operation": "in",
  "value": [200,300,100],
  // (...)
}
// (...)
```

And the workflow execution input:

```json
{
  "amount": 100
}
```

The condition `amount in [200, 300, 100]` would be `true`.

***

### `gt` (*greater than*)

The `gt` or *greater than* operator asserts that an input *i* is greater than expectation *e* (*i > e*).

#### Example

For an hypothetical workflow containing the rule:

```json Workflow
// (...)
{
  "type": "Conditional",
  "field": "amount",
  "operation": "gt",
  "value": 300,
  // (...)
}
// (...)
```

And the workflow execution input:

```json
{
  "amount": 500
}
```

The condition `amount gt 300` would be `true`.

***

### `gte` (*greater than or equal to*)

The `gte`  or *greater than or equal to* operator asserts that an input *i* is greater or equal to expectation *e* (*i ≥ e*).

#### Example

For an hypothetical workflow containing the rule:

```json Workflow
// (...)
{
  "type": "Conditional",
  "field": "amount",
  "operation": "gte",
  "value": 400,
  // (...)
}
// (...)
```

And the workflow execution input:

```json
{
  "amount": 400
}
```

The condition `amount gte 400` would be `true`.

***

### `lt` (*less than*)

The `lt` or *less than* operator asserts that an input *i* is greater than expectation *e* (*i < e*).

#### Example

For an hypothetical workflow containing the rule:

```json Workflow
// (...)
{
  "type": "Conditional",
  "field": "amount",
  "operation": "lt",
  "value": 300,
  // (...)
}
// (...)
```

And the workflow execution input:

```json
{
  "amount": 200
}
```

The condition `amount lt 300` would be `true`.

***

### `lte` (*less than or equal to*)

The `lte`  or *less than or equal to* operator asserts that an input *i* is less or equal to expectation *e* (*i ≤ e*).

#### Example

For an hypothetical workflow containing the rule:

```json Workflow
// (...)
{
  "type": "Conditional",
  "field": "amount",
  "operation": "lte",
  "value": 400,
  // (...)
}
// (...)
```

And the workflow execution input:

```json
{
  "amount": 400
}
```

The condition `amount lte 400` would be `true`.

***

### `between` (*between*)

The `between` operator asserts that an input *i* is within the range specified in array *e* (*i ∈ \[ e1, e2 ]*). It expects an array of exactly 2 values in the `value` field that will be used to delimit the expected range. **It is inclusive in both ends**.

The data type of these values needs to comply with the data type defined in the respective scope. As an example, if the `amount` field is set as `Numeric`, then the array may only contain numeric values.

#### Example

For an hypothetical workflow containing the rule:

```json Workflow
// (...)
{
  "type": "Conditional",
  "field": "amount",
  "operation": "between",
  "value": [200, 300],
  // (...)
}
// (...)
```

And the workflow execution input:

```json
{
  "amount": 250
}
```

The condition `amount between [200, 300]` would be `true`.

## Data Type Compatibility

Different field data types mean different operators available. Below is a table that summarizes the compatibility between field data types and the available operators.

| Data Type / Operation | `eq`               | `in`               | `gt`               | `gte`              | `lt`               | `lte`              | `between`          |
| :-------------------- | :----------------- | :----------------- | :----------------- | :----------------- | :----------------- | :----------------- | :----------------- |
| `Numeric`             | :white-check-mark: | :white-check-mark: | :white-check-mark: | :white-check-mark: | :white-check-mark: | :white-check-mark: | :white-check-mark: |
| `String`              | :white-check-mark: | :white-check-mark: | :x:                | :x:                | :x:                | :x:                | :x:                |