Macro Resource#

Macros can be defined as a sequence of Rulex Platform REST API calls saved in a code form which are executed as a whole in a single trigger command.

This is extremely useful when you need to automate complex processes composed by several computations of flows and tasks.

Tip

Together with computations command, import/export, delete/creation of resources and tasks, reset of precedent computation and modification of options and histories can also be saved in a macro code.

Macro code#

To represent a sequence of Rulex Platform REST API calls in a code, we use the CLI general approach.

As explained here, any REST API call can be expressed as a command line code. The same representation is used in any macro code.

Example

The following code:

compute -a compute -c flow -rs '/RulexDesktop/Test/Robotic Data Correction' -rtp flow -q mode=selected -b '{"compute_params": {"inmemory": 0}, "taskList": ["corrections"]}'
session -a delete -c taskhistoryrows -rs '/RulexDesktop/Test/Robotic Data Correction' -rtp flow -q task=corrections -b '{}'
session -a set -c resetflow -rs '/RulexDesktop/Test/Robotic Data Correction' -rtp flow -q mode=soft -b '{"taskList": ["fromtask4", "fromtask7", "fromtask3", "fromtask1", "fromtask5"]}'
compute -a compute -c flow -rs '/RulexDesktop/Test/Robotic Data Correction' -rtp flow -q mode=upto -b '{"compute_params": {"inmemory": 0}, "taskList": ["corrections"]}'

performs this actions in a sequence:

  1. Computes the task corrections in the flow Robotic Data Correction into environment Test.

  2. Modifies history of the same task corrections by deleting all the rows.

  3. Performs a reset soft on tasks fromtask4, fromtask7, fromtask3, fromtask1, fromtask5 in the same flow.

  4. Computes all the tasks up to task corrections as final operations.


Using macros#

To create a macro resource, you need to open the Explorer (for more information refer to this page) and follow this:

Procedure

  1. Click the Explore resources icon to open the Explorer pane.

  2. Toggle off the primary resource filter by clicking on the Primary filter on the upper right side of the Explorer panel to add general resources.

  3. Hover over the Plus button.

  4. Select Add new Macro and a dedicated window will appear on the screen.

  5. Insert a unique name for the new resource.

  6. Insert the Macro code in the corresponding box.

  7. Click Create: the new Filesystem resource will now be added to the list.

Once the macro resource is created it can be computed at any time by right-clicking on it and by selecting the dedicated Execute Macro entry.

Tip

Macro resource computation can also be scheduled using CLI, API approach.

See also

Macro code can also be recorded from Rulex Factory stage toolbar.

See also

Saved Macro resources can be related to flow events to prevent not allowed user to modify the internal code.