Cycle
  • 28 Mar 2024
  • 3 Minutes to read
  • Dark
    Light

Cycle

  • Dark
    Light

Article Summary

General

This type of action can be used to repeat a set of other actions (child actions of the cycle) for every value of a Datasource field.

Example: Suppose you have a datasource that contains a field Year; if you want to create one report document for every value of that field, you can create a cycle with that field and add a Create Report Document Action as a child action of the cycle.

The number of child actions is not limited and you can even nest cycles within each other.

Properties

This type of action has the following properties:

Name

Description
DescriptionDatasource Field. When selecting this option you can select a datasource field whose values will be used for the cycle.

Expression. When selecting this option you can specify an Expression that returns a list of values to use for the cycle.
Datasource FieldThe datasource field whose values you want to cycle over. This property is only applicable when the Source is set to Datasource Field.
SelectorDetermines which values of the datasource field shall be used for the cycle.

All. If you select this option, all values of the field will be used for the cycle, regardless of the filters which are currently set in the datasource.

Filtered. If you select this option, only values to which the datasource field is explicitly filtered will be used for the cycle.

Applicable. If you select this option, all values of the datasource field that are compatible with the filters which are currently set in the datasource will be used for the cycle. This property is only applicable when the Source is set to Datasource Field.
ValuesAn Expression that returns the values to be used for the cycle. This property is only applicable when the Source is set to Expression.
Sort OrderDetermines in which order the cycle values shall be processed.

None. If you select this option, the values will processed in the order in which the datasource returns them when Mail & Deploy queries them.

Ascending. If you select this option, the values will be processed in ascending order.

Descending. If you select this option, the values will be processed in descending order.
Automatically Filter To Cycle ValueBy default, Mail & Deploy will not filter the datasource field used for the cycle to the cycle value that is currently processed. If you activate this option, the datasource field will be filtered to the currently processed cycle value before child actions of the cycle will be executed.
Value NameThis is the name of an internal cached variable in which the currently processed cycle value is stored; that variable can be accessed in all Expressions in child actions of the cycle.
Exception BehaviorThis setting determines how the cycle shall behave if an exception occurs in any of the child actions of the cycle.

Do Not Handle. If you choose this option, any exception that occurs will not be handled by the cycle and instead passed to the parent of the cycle (which can either be another container action, such as a group or another cycle, or the task if the cycle is a direct child of the task). The cycle will not continue to execute child actions.

Cancel Cycle. If you select this option and an exception occurs, the cycle will cancel (i. e. stop the execution of child actions) but the exception will not be passed to the parent container; the execution will resume after the cycle.

Continue With Next Action. If you select this option, the cycle will continue with the child action succeeding the one whose execution raised an exception.

Continue With Next Cycle Value. If you select this option, the cycle will resume the execution with the first child action and the cycle value succeeding the one whose processing raised an exception.

Examples

Cycle Over Values returned by an Expression

If you set the Source property to Expression and set the following Expression in the Values property, the action will perform a cycle over the numeric values 1, 2, and 3:

Value Expression

CreateList(1, 2, 3)


Was this article helpful?