Add a condition step to the method flow
The Condition step enables you to split the method flow to different routes depending on the value of a specified field.
The get-account method accepts an account number in the example above and returns the corresponding account details. The condition in the example determines whether the request succeeded or failed and sets a different route for each outcome.
1. Place the Condition step box in the flow
To add a condition step to the method flow, perform the following:
- Place the Condition step box after the step that provides the input to the condition.
In this example, the Condition step is placed after the Gactcs9 asset step.
2. Set the first condition branch
-
Click Case 1 to set the first condition branch. The condition wizard displays the fields outputted by the step that precedes the condition step.
-
Select the field that serves as the condition input.
In the example, select the rtMsg field responsible for storing the request success status.
-
Click Next. The second wizard step is displayed.
-
Set the condition branch by specifying the case name, the logical operator, and the field value.
Click thesign when you finish.
In the example, set the first branch to the outcome of a successful request (SUCCESSFUL GET).
-
Click Close to display the method flow canvas.
-
Open the Output step and set it to fields that constitute the first branch output.
The Output step consists of the output fields copied from the Gactcs9 asset in the example. The copied asset fields constitute the account details returned when the get-account method is successful.
- In the output step mapper, map the Output step fields to the output fields of the step preceding the condition and click Close.
In the example, map the Gactcs9 asset output fields to the Output step fields.
3. Set the second condition branch
- Open the Condition step again, click Add Case, and set the second condition branch. In addition, determine the next step for this condition branch. You can select between a New Output, Existing Output, and a New Asset step.
In the example, set the second branch to outcomes different than SUCCESSFUL GET and connect it to a new output that accepts the resulting error message.
-
Click Close to display the method flow canvas.
-
Open the second branch's Output step and define its fields.
In the example, the second branch output is an error message confirming that the request had failed. Manually create a field to hold that message string.
- In the second branch Output mapper step, map the Output fields to the output fields of the step preceding the condition.
In the example, map the rtMSG field to the second Output step errorMessage field.
- Click Close and review the resulting method flow.
Updated 4 months ago