{{ transformations:IterateColumnAction.png}}
====== ITERATE COLUMN ======
Category: Workflow / Internal \\

\\ 
=====Description=====
Iteratively call another module or project and pass the columns of the input dataset to the called module/project, one column per iteration.

The called module (or project) must have the [[transformations:input|Input]] action in order to receive a column passed from the calling module. During iterations, the //Input// action is populated with one column passed from the calling module at a time. The column will be automatically given a specific temporary name that can be used in module calculations, thus making it possible to apply the same calculation logic to many columns with different names.

\\
=====Use cases=====
The action allows applying the same calculation logic to all columns of a dataset and is useful for dealing with matrix tables or performing complex data quality checks for multiple columns.



\\ 
=====Action settings=====
^Setting^Description^
|Module/Project to run<sup>*</sup>|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.|
|Column name|Enter the name that will be assigned to all columns as they are passed to the called module.|
|Mode|Choose whether to just iterate the called module (or project) and //not// return any results, or iterate and return\\ columns.  Options:  //Iterate, ignore results// or //Iterate, append result columns// (and select the Result table from\\ the called module or project; returned columns will be appended side-by-side).|
|Assign parameters|Select the parameter(s) in the called module (or project) to pass values in through, and enter the associated value(s)<sup>*</sup> (can be a text/number, or parameter).|
|Exclude selected columns|Check to exclude selected columns from being iterated. Select the columns to be skipped and not be sent to the called module.|
<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\

\\ 
=====Remarks=====
Note that the action automatically gives the columns a specified name when they are passed to the called module. As a result, the [[transformations:input|Input]] action of the called module always contains one column with the same name, regardless of what it was called in the calling action. This allows using a workflow designed for one column name to work over all columns in the source dataset.

{{ :undefined:iterate-column-schema.png?nolink |}}

Optionally, the resulting datasets of the called module can be appended side to side into one tabular dataset. In this case, only the column with the same name as in //Input// will be returned back to the calling module and renamed back to its original name. Other columns from the result table will be ignored and discarded.

\\ 
=====Examples=====
**Mode:  Iterate, ignore results** — do not return anything from the iterated module, i.e. just run it one or several times. (top image, below)\\
{{  transformations:iterate-mode - columns.png  }}
**Mode:  Iterate, append result columns** — run the module one or several times, return a table (the result dataset) from each iteration, append all result columns into one, which becomes the output of the "Iterate column" action. (bottom image, above)\\

\\ 
=====Community examples=====
  * [[https://community.easymorph.com/t//1689/2|How to use iterate column action]] ([[https://community.easymorph.com/uploads/short-url/ezX9RWE3v2mqtc04PpyZ0hLB9nZ.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 2//; Action position: //3//)
  * [[https://community.easymorph.com/t//1870/4|Send email - Add table extract to outlook email message]] ([[https://community.easymorph.com/uploads/short-url/xnfDuDCTN6iJgA4pEcQQsRIZET3.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Column widths (added for convenience)//; Action position: //2//)

\\ 
=====See also=====
  * [[transformations:input|Input]]
  * [[transformations:iterate|Iterate]]
  * [[transformations:iteratetable|Iterate table]]
  * Read [[http://easymorph.com/learn/iterations.html|Iterations and loops in EasyMorph]] for more details regarding this action.
