Table of Contents
ITERATE
Category: Workflow / Internal
Description
This action calls another project once for each row in a table. Parameters of the called project are assigned using the calling table's fields.
Use cases
Iterate is used to create "FOR…EACH" and "FOR…NEXT" types of loops within EasyMorph.
Action settings
Setting | Description |
---|---|
Module/Project to run* | Select whether to call a module (within the current project), or an external project (.morph file), then select the module, or browse to the project file. |
Iteration mode | Choose whether to just iterate the called module (or project) and not return any results, or iterate and return a dataset. Options: Iterate or Iterate and append results (and select the Result table from the called module or project). |
Assign parameters | Select the parameters in the called module (or project) to pass values in with, and the associated columns* in the calling dataset that contains the values being passed. |
When an iteration fails | Select how EasyMorph will handle situations when iterations fail. Options: Halt project or Collect errors and continue (a new column, "Iteration errors", will be created in the dataset to capture any errors that occurred during the iterations). |
* Setting can be specified using a parameter.
Remarks
Appending the result datasets is similar to the Append another table action. Columns with the same name are concatenated into one column while columns with unique names are extended with empty cells.
To create a "FOR…NEXT" type of loop, generate a sequence of numbers from 1 to N using the Sequence action, then iterate across the sequence using Iterate.
Examples
Iterate — do not return anything from the iterated module, i.e. just run it one or several times.
Iterate and append results — run the module one or several times, return a table (the result dataset) from each iteration, and append all result datasets into one, which becomes the output of the "Iterate" action.
Community examples
- Sending an email notification when project fails (Project; Module: Main; Group: The "Skip" action; Table: Example 2; Action position: 3)
- Load only workbooks with given number of sheets (Project; Module: Main; Group: Tab 1; Table: Get file names to load;
Action position: 3) - Get Date from Year, Week and Day of Week (Project; Module: Module 1; Group: Tab 1; Table: Table 1; Action position: 2)
- How to process parent-child data structures (Project; Module: Get subfolders; Group: Tab 1; Table: Table 1; Action position: 2)
See also
- Read Iterations and loops in EasyMorph for more details regarding this action.