bmel:switch¶
Category: Logic & Control Flow · Returns: bmel:any
bmel:switch(subject: bmel:any, case: bmel:any, result: bmel:expression, [otherwise: bmel:expression])
Description¶
Evaluates subject against one or more case/result pairs (left to right) and returns the result of the first matching case. If no case matches, returns otherwise or null if omitted.
Arguments¶
| Parameter | Type | Required | Description |
|---|---|---|---|
subject | bmel:any | The expression or field value to match against each case. | |
case | bmel:any | A candidate value to compare against subject. Repeat case/result pairs for additional branches. | |
result | bmel:expression | Expression returned when subject equals the immediately preceding case value. | |
otherwise | bmel:expression | Fallback expression returned when no case matches. Returns null if omitted. |
Example¶
bmel:switch({order:Response Payload}.$.status, "SUCCESS", 1, "FAILURE", 0, -1)