Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision |
transformations:repeat [2021/06/09 14:29] – [Examples] dmitry | transformations:repeat [2021/07/17 23:38] – [Community examples] craigt |
---|
\\ | \\ |
=====Description===== | =====Description===== |
The //Repeat// action allows for arranging ''DO…WHILE'' and ''DO…UNTIL'' types of loops. It repeatedly calls a module (or another project) until/while its result table is not empty, or empty, depending on the settings.\\ | The //Repeat// action allows for arranging "DO…WHILE" and "DO…UNTIL" types of loops. It repeatedly calls a module (or another project) until/while its result table is not empty, or empty, depending on the settings.\\ |
| |
\\ | \\ |
|Mode|Select the appropriate options for handling the return of results, and the timing of loops. See the Mode settings table, below.| | |Mode|Select the appropriate options for handling the return of results, and the timing of loops. See the Mode settings table, below.| |
|Fail if number of iterations exceeds<sup>*</sup>|Enter a value to represent the maximum number of loops the //Repeat// will perform before failing. This prevents malformed //Repeat// actions from running infinite loops by stopping at a pre-defined point.| | |Fail if number of iterations exceeds<sup>*</sup>|Enter a value to represent the maximum number of loops the //Repeat// will perform before failing. This prevents malformed //Repeat// actions from running infinite loops by stopping at a pre-defined point.| |
|Assign parameters|If values will be passed into the called module/project via parameters, select the parameter name to use,\\ and the value<sup>*</sup> being passed in.| | |Assign parameters|If values will be passed into the called module/project via parameters, select the name(s) of parameter(s) to assign,\\ and enter the value<sup>*</sup> being passed in.| |
<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ | <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
\\ | \\ |
|Append and return all results|Select this to continually append the results from all iterations and return the accumulated results.| | |Append and return all results|Select this to continually append the results from all iterations and return the accumulated results.| |
|**//WHILE result table is empty// loops** || | |**//WHILE result table is empty// loops** || |
|Return the first not empty result|Select to return the first non-empty dataset once the module's (or project's) criteria has been met.| | |Return the first not empty result|Select to return the first non-empty dataset once the module's (or project's) criteria have been met.| |
|Delay between iterations|Check this setting to insert a delay between loops and enter the number of seconds<sup>*</sup> to delay.| | |Delay between iterations|Check this setting to insert a delay between loops and enter the number of seconds<sup>*</sup> to delay.| |
<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ | <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
{{ :transformations:repeat-inputs.png?nolink640 |}} | {{ :transformations:repeat-inputs.png?nolink640 |}} |
| |
| When using the [[transformations:input|Input]] action in the called module, you can use the "Populate automatically" button to import the current dataset from the calling module to use as test data to build the rest of the module with. |
| |
You may need to balance the "Delay..." and "Fail after..." settings so your workflow succeeds or fails within an acceptable period of time. | You may need to balance the "Delay..." and "Fail after..." settings so your workflow succeeds or fails within an acceptable period of time. |
> Fail if the number of iterations exceeds "1000" | > Fail if the number of iterations exceeds "1000" |
> There are no parameters in this example. | > There are no parameters in this example. |
| |
\\ | \\ |
**Module 2 ("WatchFolder"):** Set up a //List of files// action pointing to the watched folder.\\ | **Module 2 ("WatchFolder"):** Set up a //List of files// action pointing to the watched folder.\\ |
If a file does not appear in the target folder before //Repeat// has run 1000 iterations, the //Repeat// will fail with an error. | If a file does not appear in the target folder before //Repeat// has run 1000 iterations, the //Repeat// will fail with an error. |
| |
{{ transformations:repeat_flow.png?640 }} | {{ transformations:repeat_flow.png?550 }} |
| |
| |
| \\ |
| ====Community examples==== |
| * [[https://community.easymorph.com/t//2156/1|How to process parent-child data structures]] ([[https://community.easymorph.com/uploads/short-url/zmylfn4Qr0ovzu3e5rybl0LVMNG.morph|Project]]; Module: //Module 1//; Group: //Tab 1//; Table: //Scan all folders//; Action position: //2//) |
| * [[https://community.easymorph.com/t//2160/1|How to pull data from web APIs with pagination]] ([[https://community.easymorph.com/uploads/short-url/dvCSpcEDXYZ8aB0B2gtnt7qulTF.morph|Project]]; Module: //Main//; Group: //Group 1//; Table: //Query API with pagination//;\\ Action position: //2//) |
| * [[https://community.easymorph.com/t//2186/2|Excel IRR formula]] ([[https://community.easymorph.com/uploads/short-url/r3hO74ebEfwvCgq0YqkKt7bqGM2.morph|Project]]; Module: //IRR_TWO_NEAREST//; Group: //Group 1//; Table: //INPUT//; Action position: //3//) |
| |
\\ | \\ |
=====See also===== | =====See also===== |
| * [[transformations:input|Input]] |
* [[transformations:iterate|Iterate]] | * [[transformations:iterate|Iterate]] |
* [[https://easymorph.com/learn/iterations.html| Tutorial: Iterations (loops)]] | * [[https://easymorph.com/learn/iterations.html| Tutorial: Iterations (loops)]] |
| |