bmel:if¶
Category: Logic & Control Flow · Returns: bmel:any
Signature
bmel:if(cond: bmel:boolean, a: bmel:any, b: bmel:any)
Description¶
Inline conditional (ternary): returns a if cond is true, otherwise returns b.
Arguments¶
| Parameter | Type | Required | Description |
|---|---|---|---|
cond | bmel:boolean | Boolean condition to evaluate. | |
a | bmel:any | Value returned when the condition is true. | |
b | bmel:any | Value returned when the condition is false. |
Examples¶
Label large orders
bmel:if({createOrder:Request Payload}.$.amount > 1000, 'LARGE', 'STANDARD')
Zero instead of a negative balance
bmel:if({getOrder:Response Payload}.$.balance < 0, 0, {getOrder:Response Payload}.$.balance)