Branch Variables

Branch variables are parameters associated with specific values which affect the single task and are then propagated to children tasks within the same branch. They are available in Rulex Factory only, and they are applied to branches in flows. Branch variables are defined within tasks, and the branch variables window is available in all task families except the Evaluation one.

Users need to click on the branch variables icon on the task Toolbar to open the Branch Variables Manager window. From this window, branch variables can be managed, and its layout is similar to the one of the Variables Manager. In the Branch Variables Manager window users can add or delete a variable by clicking respectively on the Plus and Minus icons.

Then, in the Add Branch Variables window, users can specify the Number of variables which will be added, then they can specify the Name and the Code of the branch variable in the corresponding field.

Depending on the number of variables which have been added, the corresponding number of Name and Code fields will be provided on the interface.

Once the variables have been defined, click on ADD VARIABLES, otherwise click CANCEL.

The Branch Variables Manager window is divided into three columns: Name, Code, Value.

  • The Name column defines the name of the corresponding branch variable, and it can be modified.

  • The Code column is the code considered for the branch variable, and it can be modified.

  • The Value column is the value of the code inserted in the code column, and it’s read-only.

The Compute branch variables drop-down menu, located in the top-left corner of the window, defines when the branch variables will be computed, and the possible values are:

  • Before task computation: if selected, the branch variable(s) will be visualized in each child task’s corresponding option, because their value will be overwritten to the task’s ones and, after that, the task will be computed.

  • After task computation: if selected, the branch variable(s) won’t be visualized in each child task’s corresponding option, as it emulates the computation behavior, so the variables are not applied yet when the task is computing, but they will be applied after the task is computed. Basically, it will be available from the children tasks onwards.

In Import tasks only, as they can’t have any parent task, it is possible to import the branch variables from other tasks in the same flow. This is possible through the Import from drop-down list in the Branch Variables Manager window, where users can choose the task from which the branch variables will be retrieved.

Warning

When importing branch variables from another task in Import tasks (except the Import from Task task), if there are priorities set, the priority of the task which contains the branch variables to be imported is modified so that it is higher than the Import task which will receive the branch variables, when possible.

To save the changes in the Branch Variables Manager window, click on the Save icon in the task Toolbar.

To close the Branch Variables Manager, click Close in the bottom-right corner of the panel.

Once a variable is generated in a task, all its children tasks will inherit it.

Any editing operations over variables (addition, deletion, edit) performed in the children tasks will be valid from the child task itself to its children tasks.

For example, in a branch made of an import task, a Data Manager task, a Split Data task and an LLM task, where the branch variable Var_1 has been added to the import task, and the branch variable Var_2 has been added to the Split Data task, Var_1 will be applied to all tasks, and Var_2 will be applied to the Split Data and the LLM tasks only.

Warning

If an Environment Variable, a Flow Variable or a Runtime Variable with the same name of the Branch variable is present, the value of the Branch variable is overwritten to the existing one(s).

To check all the branch variables modifications and computation status, it is possible to open the History by clicking on the corresponding icon on the toolbar.

Branch variables history panel

The branch variables history panel can be opened by clicking on the corresponding button on the task’s Toolbar, and it contains all the operations performed within the branch variables, along with their computation status. The icon varies according to the variables’ computation status, and the possible statuses are listed in the table below.

Its layout is the same as the History tab in the Data Manager task (more information available in the corresponding page), as well as the operations available by right-clicking on each history row, apart from the Compute option, which is present in the branch variables’ history only.

To close the branch variables history panel click on the Close button.

Icon

Description

undefined

The variable is disconnected from the rest of the flow and can not be computed.

ready

The variable is connected but not computed yet.

pending

A computation containing the selected task is on going. The variable is going to be computed.

running

The variable is being computed.

completed

The variable has been computed without errors.

error

The variable has been computed with errors.

warning

The variable has been computed with warning.

dirty

The variable is computed, but data stored are no longer aligned with options or history in the variable history.


Example

The following example shows how to set up a branch variable which retrieves emails from the Outlook connector (more information can be found here) received within a specified timeframe and then deletes them using a File Manager task.

  • Create a flow and add any Import task.

  • On the stage, click on the Variables tab, then click on the pencil icon located on top of the tab to open the Variables Manager.

  • In the Variables Manager window, define the following variables:
    • connstring, which is a connection parameter for the Outlook connector.

    • cuttime, which contains the formula defining the timeframe (6 hours, in this case). currDatetime() - time (6, 0, 0)

    • domain, which is a connection parameter for the Outlook connector.

    • filelist, which is the name of the branch variable which we will use later on in the Branch Variables window of the Data Manager task.

    • startdate, which is a connection parameter for the Outlook connector.

https://cdn.rulex.ai/docs/Factory/branchvars-example-1.webp
  • Add an Import File Info task onto the stage, then configure the connection to Outlook using the variables defined in the Variables Manager in the corresponding fields, explained here.

  • Save and compute the task.

  • Add a Data Manager task to the stage and link it to the Import File Info task, then perform a Pre filter operation on the Modified attribute, by defining the filter in the Code section as follows: $"Modified >= (@cuttime)" so that all the items received more than six hours ago will be displayed.

https://cdn.rulex.ai/docs/Factory/branchvars-example-4.webp
  • Open the Branch Variables Manager and set up the following branch variable:
    • Compute branch variables: After task computation

    • Name: filelist

    • Code: extractSymbol($"Location"), so that the values of the Location attribute are extracted.

https://cdn.rulex.ai/docs/Factory/branchvars-example-2.webp

These operations will then be visible in the Branch Variables History.

  • Save and compute the task.

https://cdn.rulex.ai/docs/Factory/branchvars-example-3.webp
  • Add a File Manager task onto the stage and link it to Data Manager task, then open the File Manager task and set up the connection to Outlook using the variables which have been previously used in the Import File Info task.

  • Then, select one email and right-click on it, then select Delete.

  • Once the confirmation deletion window opens, click on the fx button to access the parametric mode, then type the variable @filelist, so that the items identified by this variable’s code will be deleted.

  • Click Apply, then save and compute the task.

https://cdn.rulex.ai/docs/Factory/branchvars-example-6.webp