# Filter

> The run goes on only when this holds. Otherwise it stops quietly, without failing.

Source: https://docs.go-lumen.ai/es/reference/nodes/filter

## De un vistazo

| Propiedad | Valor |
| --- | --- |
| **Node field** | `filter` (set instead of `stepRef` on a FlowNode) |
| **Side effects** | no |

A FlowNode sets exactly one of `stepRef`, `branch`, `filter`, `forEach`, `wait` and `approval`.

Conditions use the expression language: a field, an operator and a value, as in `{field: details.total, op: gte, value: 10000}`.

## Ajustes

El valor del campo del nodo, con estos ajustes.

| Ajuste | Tipo | Valor por defecto | Descripción |
| --- | --- | --- | --- |
| `when` | object |  | When may be left out while the filter is not set up yet, as in a branch case; the webhook reports the Flow incomplete. |
| `when.expr` | string |  | Expr is the condition as text. Every field in it is a node or trigger upstream on every path to this one, and one of its outputs. |
| `when.field` | string |  | Field is <nodeId>.<field>: a node or trigger upstream on every path to this one, and one of its outputs. |
| `when.op` | string |  |  |

El JSON Schema completo de estos ajustes: [filter.schema.json](https://docs.go-lumen.ai/schemas/nodes/filter.schema.json).

## Úsalo en un flujo

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
  name: my-email-forward
  namespace: tenant-acme
spec:
  classRef: {name: email-forward}
  config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: filter-example
  namespace: tenant-acme
spec:
  displayName: "Filter"
  triggers:
    - id: start
      ref: {name: email-arrives}
      connectorRef: {name: my-email-forward}
      next: [from-suppliers]
  nodes:
    - id: from-suppliers
      filter:
        when: {field: start.from, op: contains, value: "@supplier.example"}
      next: [text]
    - id: text
      stepRef: {name: read-text}
```
