Conditional Operation
There are two ways to go about creating a conditional operation.- Using the
if,thenandelsemethods of theConditionalOperationclass. - Creating
Conditionobjects and passing them to the constructor of theConditionalOperationclass.
1. Using the if, then and else methods
Using the Condition class
The Condition class can be used to construct a conditional operation without using the if, then and else methods.
Condition objects can be reused and combined to create more complex conditional operations.
A condition looks is implemented as follows:
value_a and value_b fields are the operands of the condition. The operator field determines the type of condition. The action field is the work step or operation that will be executed if the condition is met.
The value_a and value_b fields can accept any of the following:
- A work step or operation output
- Another condition
- A static value
Condition class as follows:
Combining conditions
You can combine conditions to create more complex conditions as shown below:Referencing web2 payloads in conditions
Web2 requests return various shapes of payload when executed, including plain text or JSON. Let’s illustrate how you can reference these payloads using a GET request to read the current BTC price.bitcoin object under the usd key. We can reference the value as shown below: