Loop File Contents Action
<AMLOOP TYPE="FILECONTENTS" FILE="Text" RESULTVARIABLE="Text" DELIMITER="Text">
Loops through the contents of a specified text file and populates a variable with the current string of delimited text. The loop ends at the end of the file or if a Break step is encountered.
This action wraps the functionality of a Read from File action and a Loop List action into one concise loop structure.
To perform an action on each item in a delimited text file.
Specifies the file to loop.
Specifies an already created variable that should be populated with the next delimited string on each successive loop.
Specifies the character that delimits the items in the file.
The available options are:
comma: The delimiter is a comma (e.g. item1,item2,item3).
new_line: The delimiter is a new line (default).
semi_colon: The delimiter is a semi colon (e.g. item1;item2;item3).
space: The delimiter is a space (e.g. item1 item2 item3).
tabulation: The delimiter is a tab character.
(custom): The delimiter is another character as specified (simply use the character).
This action includes the Description tab for entering a custom step description.
More on setting custom step description
This action also includes the standard Error Causes and On Error failure handling options/tabs.
More on Error Handling Options
All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.
More on variables
More on expressions
More on the expression builder
NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.
<AMLOOP TYPE="FILECONTENTS" FILE="C:\Temp\FileName.txt" RESULTVARIABLE="VariableName" DELIMITER="|">