Skip to content

Switch

The Switch module evaluates multiple conditions defined as routes and routes data to the corresponding outputs. It works similarly to a switch/case in programming. It supports two evaluation modes: first_match (only the first match) and all_matches (all matches in parallel). Each route defines a field to evaluate, a comparison operator, and a reference value. Available operators include: equality, inequality, greater/less than, contains, starts/ends with, is empty, belongs to list, and regular expressions. If no condition is met, data is sent through the Default route. It supports up to 4 custom routes plus the Default route.

ParameterTypeRequiredDescription
modeselectYesEvaluation mode: First match (first_match) or All matches (all_matches). Default: first_match.
routesswitchRoutesNoDefines the conditions for each output route. Each route evaluates a field with an operator and value.
{
"nextModule": "modulo_ruta_1",
"data": { "datos_originales": "sin_modificar" },
"_meta_": {
"switchMode": "first_match",
"matchedRoutes": [
{ "index": 0, "name": "Ruta VIP", "target": "procesoVIP" }
],
"usedDefault": false,
"totalRoutes": 3,
"evaluatedAt": "2026-03-23T10:00:00.000Z"
}
}
{
"label": "Switch",
"mode": "first_match",
"routes": [
{ "name": "Ruta VIP", "field": "data.tipo_cliente", "operator": "equals", "value": "vip" },
{ "name": "Ruta Premium", "field": "data.tipo_cliente", "operator": "equals", "value": "premium" },
{ "name": "Monto Alto", "field": "data.monto", "operator": "greater_than", "value": "1000" }
]
}
  • Available operators: equals (==), not_equals (!=), greater_than (>), less_than (<), greater_or_equal (>=), less_or_equal (<=), contains, not_contains, starts_with, ends_with, is_empty, is_not_empty, in, not_in, regex.
  • In first_match mode, it stops at the first route that meets the condition.
  • In all_matches mode, it sends data to all matching routes (in parallel) and returns an array of nextModule.
  • Text comparisons (contains, starts_with, ends_with, in, not_in) are case-insensitive.
  • Supports dot-notation paths to access nested properties using lodash _.get (e.g.: user.address.city).
  • For the in operator, values are separated by commas (e.g.: "vip,premium,gold").
  • Supports up to 4 configurable routes (route_0 to route_3) plus the Default route.
  • Data passes without modification; the Switch only decides the route.
  • Decision - simple binary true/false evaluation
  • Router - routing by field value with exact match
  • MergeMultiple - to reunite parallel branches from the Switch