The Payroll department sends biweekly statements to their insurance and employee investment trading partners. The department prefers to send statements in batches of at least 10 files. If less than 10 files are found in the File Set, the loop is exited and no file processing occurs.
Create a File List:
From within the Project Designer page, expand the File System folder in the Component Library, and then drag the Create File List task to the Project Outline.
On the Create File List page, specify the File List Variable.
Specify a Variable for the Number of Files Found.
Click the
Add
button in the page toolbar and select the File Set menu item.
In the File Set page, type the complete directory path to the Base Directory that contains the files or click the
icon to browse for the directory.
Create the For-Each Loop:
From within the Project Designer page, expand the Loops folder in the Component Library, and then drag the For-Each task to the Project Outline.
Specify the Items Variable and the Current Item Variable for the For Each Loop.
Create the Exit Loop:
On the For-Each Loop page, click the
Add
button in the sub-menu and select the Add Exit Loop menu item.
On the Exit Loop page, specify a Condition. If the Condition is met, the loop is exited and no other tasks within the loop are performed.
Add additional Tasks (after the Exit Loop ) to continue to process the files if the Exit Loop Condition is not met. For instance, if there are less than 10 files in the File Set.