Updated on 2023-12-28 GMT+08:00

Referencing Variables

Orchestrating a composite application flow and configuring connectors and processors involve various inputs, outputs, and configurations, which can be referenced as variables when you edit and design a composite application to create efficiency.

Variables of composite applications are classified as system, node, and custom variables. Variables with the same name are prioritized as follows: system variable > node variable > custom variable.

System Variables

System variables indicate system parameters or specific outputs of some connectors. Table 1 lists the system variables for composite applications.

System variable reference mode: ${Variable name}
Table 1 System variables

Variable

Description

step_execution_time

Execution duration of the previous node, in milliseconds.

response_code

Response code of the previous HTTP request node.

selected_row_count

Number of data records queried in the previous database node.

Only MySQL, Gauss 200, PostgreSQL, Oracle, SQL Server, and Db2 databases are supported.

updated_row_count

Number of data records that are inserted, updated, and deleted in the previous database node.

Only MySQL, Gauss 200, PostgreSQL, Oracle, SQL Server, and Db2 databases are supported.

loop_index

Previous loop node; index of the current loop; the value starts from 0.

loop_size

Total number of loops in the previous loop node.

split_index

Previous splitter node; index of the current data block during data splitting; the value starts from 0.

split_size

Number of data splits on the previous splitter node.

split_complete

Whether data splitting is complete in the previous splitter node.

Node Variables

The execution result of the previous node can be used as a node variable and referenced by subsequent nodes, such as the request body of an OpenAPI, database query result, and HTTP request result.

Node variable reference mode: ${payload}

If the execution result is an object, such as a JSON or XML object, use ${payload.id} or ${payload[0].id} to reference certain data in the execution result.

Example:

If the response body received by an HTTP request node is in JSON format as follows, use ${payload} to reference the JSON data, ${payload.id} to reference the value 00000000, and ${payload.data[0].value} to reference the value x.

{
    "id":"00000000",
    "name":"sample01",
    "data":[
        {
            "id":1,
            "value":"x"
        },
        {
            "id":2,
            "value":"y"
        },
        {
            "id":3,
            "value":"z"
        }
    ]
}

Custom Variables

Custom variables can be referenced in subsequent nodes, and include the following items: variables added when configuring variables, request parameters added in the OpenAPI and the variable assignment nodes, and output variables configured in the script node.

Custom variable reference mode: ${variable name/parameter name}

  • Adding variables on the canvas page
    1. Log in to the new ROMA Connect console.
    2. In the navigation pane on the left, choose Composite Applications. On the page displayed, click the target composite application.
    3. Click on the composite application and choose Modify to enter the canvas page.
    4. Click Variable on the top of the page.
    5. In the pop-up box displayed, click Add.
      Table 2 Configure variables

      Parameter

      Description

      Variable

      Enter a variable name to be referenced.

      Type

      Data type of the variable: string, integer, long integer, decimal, boolean, and password.

      Value

      Enter the value of the variable.

      Scope

      Select the effective scope of the variable: global (all composite applications); current composite application.

      Description

      Enter a description of the variable.

    6. Click Save.
  • Adding request parameters in the OpenAPI node

    For details, see OpenAPI.

  • Adding variables in the variable assignment node

    For details, see Variable Assignment.

  • Configuring output variables in the script processing node

    For details, see Script.