Runtime Variables#

Runtime variables are variables which are used at runtime, namely they overwrite the existing flow/environment variables only for the current run.

For more information about variables and how to use them, go to the corresponding page.

The Runtime Variables task allows users to specify the runtime variables, starting from a file containing them.

Warning

  • The flow must have a task with a dataset containing, among other data, 2 columns, which will be used respectively to fill the Attribute for names and the Attribute for values options.

  • The task can have its priorities customized: even though it is located in a different branch of the flow, for example, it can be computed before certain tasks, so that they receive the required runtime variables.

  • Only one Runtime Variables task can be included in each flow.

The task is made of one tab only, the Options tab.


The Options tab#

The following options are available within this tab:

  • Attribute for names: select the column that contains the flow variable names from the drop-down list.

  • Attribute for values: select the column that contains the flow variable values from the drop-down list.

  • Overwrite the current value if the variable is already defined: if selected, any values defined in the other variables with the same name will be overwritten by the runtime variables’ values.

  • Activate Rulex4 module names back compatibility: if selected, Rulex4 modules names back compatibility will be activated.


Example#

The following example uses the Discount value and the Northwind order details datasets.

  • Import the Northwind order details dataset through an Import from Text File task.

  • In the Variables tab, define the Extra Code Variable with value ``0.10``.

https://cdn.rulex.ai/docs/Factory/runtimevars-example-1.webp
  • Add a Data Manager task and link it to the Northwind order details task.

  • Edit the Discount attribute by typing @Extra in the formula bar, so that the attribute contains the specified variable as its value.

https://cdn.rulex.ai/docs/Factory/runtimevars-example-2.webp
  • Import the Discount value dataset, containing the runtime variable.

  • Add a Runtime variables task and link it to the task containing the Discount value dataset. Configure the task as follows:
    • Attribute for names: Variable

    • Attribute for values: Value

    • Leave the other options as default and save and compute the task.

https://cdn.rulex.ai/docs/Factory/runtimevars-example-3.webp
  • In the Priorities tab, define the priorities as follows:
    • northwind_orderdetails task: 1

    • Discount_value task: 1

    • dataman1 task (the one right after the northwind_orderdetails task): 1

    • rtvars1 task: 2

    • dataman2 task (where we want to apply the runtime variables): 3, so that it computes after the runtime variables.

https://cdn.rulex.ai/docs/Factory/runtimevars-example-4.webp
  • Compute the entire flow by clicking on the Compute Flow button on the toolbar.

  • Open the dataman2 task: the values in the Discount attribute have been overwritten by the runtime variable value, which was 0.25.

https://cdn.rulex.ai/docs/Factory/runtimevars-example-5.webp