Iterate Merge Section
Usage | Parameters | Examples | Remarks | See Also
The Iterate merge method identifies the start of a section of text that should be repeated. This is typically used with AI Fields where an unknown number of results can be captured, although it can be used for any repeating text task in any merge field within Umango connectors.
The Iterate method should always be used with the IterateEnd method and can include a reference to the Iteration count to identify the count within the loop cycle.
The structure of the iterating section should be:
<<Iterate(5)>>
Text to repeat <<Iteration>>
<<IterarateEnd>>
When used in a collection of results, a shorthand version of the iteration count is the asterisk [*]. The usage below will result in the same outcome for each result:
<<Iterate(5)>>
Item Number: <<AI.Item.ProductCode[<<Iteration>>]>>
Item Number: <<AI.Item.ProductCode[*]>>
<<IterarateEnd>>
Usage
Iterate(n) |
Repeats the iteration n number of times |
Parameters
n Integer
The number of iterations to perform on the repeating section.
Examples
Example 1
Using the Merged Text connector, repeat a block of text 3 times and include a count of the row.
In this example, a line of text will be repeated 3 times
The resulting text file's content
Example 2
Using the Merged Text connector, repeat a block of text containing the line items of an Invoice that has been captured using Umango AI. In this example, the AI document type "Invoice" is in use and therefore a varying number of line item fields have been extracted.
In this example, each invoice line item will be listed with Quantity, Description, Unit Price and a calculated line total
The resulting text file's content
Example 3
Using the Merged Text connector, create an XML file containing each AP Invoice's data. In this example, the AI document type "Invoice" is in use and therefore a varying number of line item fields have been extracted.
A
In this example, an XML file for each invoice will be created and the Item XML tag will be repeated for each line item
The resulting XML file's content
Example 4
Iterations can also be used with regular expressions to present each result of the collection. Using a combination of the regex count and a selection of each result in the collection, the following merge example is possible.
In this example, each word within the index "My Sentence" will be written per line
The resulting text file's content
Remarks
The Iterate method must always be followed by a IterateEnd method after the text that is to be repeated. To identify the current count of iterations within the iteration text, reference the Iteration merge method.
See Also
The Iterate method is a very powerful method and can be used in many ways within Umango. However, it is most often used in combination with the Regex merge method or (in jobs with invoice document types) the items collection in the Merged Text connector.