Working with Actions

Actions perform a single or series of tasks, linked in a sequence or loop. While they can also perform checks on data, this should be avoided where possible, using Rules and then Action Maps to achieve this instead.

Actions are typically built to perform at least one of the following functions:

  • Change the data - create an object, delete an object, or update an object by assigning a Value to one of its attributes.
  • Report - produce information to appear in the Task Results report.
  • Run Built-in Operations - a packaged piece of logic in a single function.

Like Rules, Actions can operate purely on the root node's class or cover other related objects. The primary way to access other objects is using a Loop Over Objects Operation. Similar to the For All Predicate in a Rule, Loop Over Objects Operations will iterate over the other objects, performing an Operation on either the root object or objects designated by the loop. However, unlike a For All Predicate, Loop Over Objects performs an Operation using the found objects, rather than just checking and returning a boolean value.

Control flow in Actions

Operations have numerous ways to control the flow of the Actions, in particular:

Sequence

A set of nodes that runs each node's Operation in the order they are in. Additional nodes can be added if necessary.

If…Then…Else

Will only perform an Operation if the Predicate is true (any of the Predicate types used in Rules can be used for the check). If the result is false, a second, optional Operation will run if one exists.

     Note: In a If…Then…Else, the objects found using the If Predicate are not directly accessible for the subsequent Then Operation. You will need a subsequent Loop Over Objects Operation to actually get hold of the objects.

Loop Over Objects

As described above, this is used to access other objects. This is used whether accessing a single object or iterating over multiple objects. It can be constrained to only iterate over a certain number if there are multiple objects that match.

     Example: For example to get hold of a single object:

If there exists at least one X then for the first X <do something>

In practice, the Loop Over Objects Operation will only operate on objects that exist, in which case it is usually most efficient to only do the loop. For example:

For the first X <do something>

If the number of objects is important to check first, then the exists check is still needed. For example:

If there exists at least 5 X then for all X <do something>

Loop Over Nearest Objects

Loops over the nearest n number of objects and performs an Operation on each one.

Optionally, this can be filtered with a Predicate to set a second criteria. The Operation is performed for the nearest n objects that satisfy a test Predicate, in order of increasing distance from the source geometry.

Loop Over a Collection or Geometry

Iterate over the parts of a single or multi-part geometry, performing an Operation on each one. Can also be used for iterating over any collection, but these are rare.

While Loop

This will continue to run an Operation until the condition set with a Predicate stops being true (any of the Predicate types used in Rules can be used as the check here).