cannectors

condition

Branch records by boolean expression — then / else chains.

The condition filter evaluates a boolean expression against each record. Records matching the expression go through the then branch; non-matching records go through else. Both branches are themselves filter chains, so you can nest as deeply as the YAML lets you read.

Minimal example

Keep paid orders, drop everything else:

filters:
  - type: condition
    expression: "status == 'paid'"
    then: []                       # paid records continue unchanged
    else:
      - type: drop                 # everything else is removed

Options

propertytypedefaultdescription
typerequired
"condition"Module type discriminator. Must be `condition` for this module.
id
stringUnique identifier within the pipeline.
name
stringHuman-readable name.
description
string
enabled
booleantrueWhether module is active.
tags
array<string>
onError
string"fail"Default error action. Case-insensitive; normalized to lowercase by the runtime.
expressionrequired
stringBoolean expression evaluated against each record.
array<object>Nested filters to execute when condition is true.
array<object>Nested filters to execute when condition is false.

Expression syntax

Expressions are evaluated by expr, the same engine the runtime uses for retry hints and HTTP success conditions. The current record is the root context — fields are accessible by name (including dot paths).

Operators you'll use most:

OperatorExample
==, !=status == 'paid'
>, <, >=, <=amount >= 1000
&&, ||, !status == 'paid' && amount > 0
inregion in ['EU', 'US']
containsemail contains '@example.com'
matchesphone matches '^\+33'

Nested branches

then and else are full filter arrays. Common pattern: route by field, then enrich each branch differently.

- type: condition
  expression: "kind == 'B2B'"
  then:
    - type: http_call
      endpoint: https://accounts.example.com/api/companies/{accountId}
      keys:
        - field: account_id
          paramType: path
          paramName: accountId
      mergeStrategy: merge
  else:
    - type: http_call
      endpoint: https://accounts.example.com/api/individuals/{accountId}
      keys:
        - field: account_id
          paramType: path
          paramName: accountId
      mergeStrategy: merge

Filtering records out

condition itself never drops records — both branches just produce a modified record. To remove a record, put a drop filter inside the relevant branch:

- type: condition
  expression: "status == 'cancelled'"
  then:
    - type: drop

Examples

examples/11-condition-nested-routing.yamlview source ↗
11-condition-nested-routing.yaml
name: condition-nested-routing
version: 1.0.0
description: Route records with condition filters and nested filter modules.
tags:
  - condition
  - nested-filters
input:
  type: httpPolling
  schedule: "*/30 * * * *"
  endpoint: https://source.example.com/api/payments
  dataField: payments
filters:
  - type: condition
    expression: status == "paid" && amount > 0
    then:
      - type: set
        target: routing.bucket
        value: billable
      - type: mapping
        mappings:
          - source: id
            target: payment.id
          - source: amount
            target: payment.amount
    else:
      - type: set
        target: routing.bucket
        value: review
      - type: remove
        target:
          - card.number
          - card.cvv
output:
  type: httpRequest
  endpoint: https://destination.example.com/api/payments/routed
  method: POST
  requestMode: batch

Cross-references