Configuring a Conditional Branch Operator
The Conditional Branch operator obtains the request parameters or result sets of its upstream operator for condition judgment and determines the next branch to be executed based on the defined expression. If the conditions of multiple branches are met, only the first branch is executed.
Parameter |
Description |
---|---|
Branch 1 |
|
Condition Type |
Condition type.
|
Expression |
This parameter is mandatory when Condition Type is Meets the current condition. The expression consists of the code and variable name of the upstream operator. For details about how to use the expression, see Defining an Expression. |
Branch 2 |
|
Condition Type |
Condition type.
|
Expression |
This parameter is mandatory when Condition Type is Meets the current condition. The expression consists of the code and variable name of the upstream operator. For details about how to use the expression, see Defining an Expression. |
... |
|
Branch n |
|
Condition Type |
Condition type.
|
Expression |
This parameter is mandatory when Condition Type is Meets the current condition. The expression consists of the code and variable name of the upstream operator. For details about how to use the expression, see Defining an Expression. |
Defining an Expression
When defining the expression of a conditional branch, you need to configure a variable expression. Variable expressions are available for Entry API and Common API operators, but unavailable for Conditional Branch, Parallel Processing, and Output Processing operators. The standard expression format is ${Node code|Variable name}. For details about how to define an expression, see Table 2.
- Node code: It is dynamically allocated by the system and cannot be changed. You can click a node in the API orchestration canvas to view the node code and click to copy the node code.
Figure 1 Viewing the node code
- Variable name: Supported variables include request parameter values and result set parameters. For details, see Table 2.
Operator |
Variable Expression |
Example Value |
---|---|---|
Entry API |
Obtain the value of the request parameter of the entry API: ${Node code|Input parameter name}.
NOTE:
This expression is supported for POST requests whose input parameters are located in Query, Header, Path, or Body. |
If the node code of the entry API is EntryApi_3909f, and the input parameter userId is located in Path, set the expression for obtaining the value of the request parameter to ${EntryApi_3909f|userId}. |
Common API |
|
|
For example, if there are three sequential nodes, A (entry API), B (common API), and C (conditional branch), and node C needs to obtain the request parameter values of node A and the output values of node B:
- If the code of node A is EntryApi_3909f, and the location of input parameter userId is Path, set the expression for obtaining the request parameter value of node A as follows:
${EntryApi_3909f|userId}
- If the code of node B is NormalApi_4246f, and the value is a two-dimensional array of multiple rows and columns, set the expression for obtaining the value in the first row and name column in the result set of node B as follows:
${NormalApi_4246f|payload.data[0].name}
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot