Page 1 of 1

File Lists, RowSets, Email Lists

Posted: Fri Aug 02, 2019 2:12 pm
by Support_Hans
File Lists
A File List references a set of Local File or Remote File objects and directories that were retrieved or processed by a task. A File List may be the result of one or more File Sets, which allows you to create a single File List that contains files from multiple directories and/or multiple filters.
Example: To create a File that contains file information from XML files in a local directory.
Use the Create File List Task.
Add a File Set in this Task with a defined Base Directory. Add a Filter to include the Pattern *.xml that may be Case Sensitive if necessary.
Add a For-Each Loop to go through each file (Current Item Variable) in the File List (Items Variable).
Use a Print Task to append records to a file, containing the file name, when it was last modified, the file size and file path.

Other examples of a File List being used could be as the input into a Zip Task, moving files in a list, renaming each file to include a timestamp, and (since we can now list folders as well as files) deleting empty folders in a list.

RowSets
A RowSet is a variable that contains a pointer to records that were read from a file or database table. Tasks that can create a Rowset are Data Translation Read tasks and Database Select statements.
Example: A Read CSV Task creates a RowSet variable which can then be used by the Count Rowset task to create two new variables containing a count of rows and a count of columns in the Rowset.
A Read CSV Task is created with a specified Input File and Output RowSet Variable.
A Count RowSet Task could then be created with a specified Input RowSet Variable, Output Row Count Variable, and Output Column Count Variable.

Other tasks that utilize RowSets include Validate RowSet, Modify RowSet, Close RowSet, any task that writes a file and any task that writes records to a Database table. The Validate RowSet Task allows you to validate the data contained in a RowSet. The Modify RowSet Tasks allow you to select and/or exclude specific records from, as well as allowing you to add, modify, or delete columns from, a RowSet. The Close RowSet Task allows you to close the RowSet before the Project finishes, allowing you to move, rename or delete a Rowset before the project completes. Any open RowSet will be closed when a Project finishes.

Email Lists
An Email List is an output variable that contains a list of Email Messages returned by the Retrieve Email Task. This variable can then be used to retrieve the file path locations of where the attachments and message bodies were saved. These can then be used in a For Each loop to process each message individually.
Example: This project will retrieve multiple emails and process email attachments.
Within the Retrieve Email Task:
"Save Attachments" would be set to true.
In the Output Variables panel, specify an Email List Variable and Downloaded Attachments Variable.
Add a For-Each Loop to go through each email (Current Item Variable) in the email list (Items Variable).
A second For-Each Loop would be created to go through each attachment (Current Item Variable) in the email (Items Variable).
Finally, A Move Task would be used to move the attachment (Source File) into a directory where the email is renamed as the email subject with the extension of the attachment.