While aGoAnywhere DirectorProject is running, additional tasks or loops can be executed if a condition evaluates to true. The IF Condition can be placed at any point in a Project. Tasks, Loops and additional IF Conditions can be placed inside an IF Condition.
Basic Tab
Label
The label displayed in the Project Outline.
Condition
The expression that must evaluate to true for the Tasks and Loops within the IF Condition to execute. The condition is constructed usingExpressions.
Control Tab
Log Level
Specify the level of log messages that will be generated when this IF Condition executes. If not specified, then the log level will be inherited from the Project, Module, Loop or other IF Conditions.
Silent Only logs any errors that are encountered.
Normal Additionally logs the start and stop times of the IF Condition, as well as the times of any Loops and Tasks contained in the IF Condition.
Verbose Additionally logs task-level details, such as the names of the files that were processed. Debug Additionally logs detailed debugging information, such as message responses from servers.
Disabled
IF Conditions can be disabled if needed. When an IF Condition is disabled, it will appear grayed out in the Project Outline.
IF Condition Example
One file is expected in a location for processing. When more than one file is present a different process should take place.
1. Generate a File List.
a. From within the Project Designer screen, click the Actionlink in the sub-menu bar and click theAdd a Task...option.
b. On theAdd Taskscreen, open theLocal File System Tasksand selectCreate File List. c. On the Create File List screen, specify theNumber of Files Found Variablevalue.
d. Click theNextbutton to specify the file location for the File Set. 2. The IF Condition can check for the presence of more than one file.
a. From the Main Module click the Actionlink in the sub-menu bar and click theAdd Ifoption. b. On theIFscreen, type the condition statement.
3. To add a task under the IF condition, right-click theAddition Filesin the Project outline and chooseAdd a Task.... After choosing the task, it will appear in the outline, indented under the IF Condition.
Loops
Loops withinGoAnywhere DirectorProjects are used to repeat one or more tasks. A Loop can be placed inside a Module, an IF Condition, or another Loop. The following Loops are supported inGoAnywhere Director:
l For Loop- Executes one or more tasks a predetermined number of times.
l For-Each Loop- Iterates over a collection of items (File Lists, Rowsets, Email Lists, etc.). l While Loop- Executes one or more tasks repeatedly while the Loop condition evaluates to true.
l Do-While Loop- Similar to the While Loop, except the Do While Loop will evaluate the condition after each
iteration. This Loop is guaranteed to run at least once.
Sub-elements of Loops
Loops can have the following Project components:
l Tasks- Any task can be added to a Loop. l Loops- Loops can be nested.
l Exit Loop- Allows exiting a Loop based on a condition.
l Iterate Loop- Skips subsequent tasks in the current iteration of the Loop based on a condition. l IF Condition- Advanced logic to execute additional tasks or Loops if a condition evaluates to true.
Error Handling within Loops
If a Loop contains multiple tasks and the first task errors out for any reason, by default the remaining tasks in the Loop will not execute. However, if the first task's On Error attribute was set to 'continue', then the second task in the Loop would execute. If the task's On Error attribute was set to 'setVariable:errorvariable=true', then the next task in the loop could check the value of the error variable to conditionally execute.
For Loop
A For Loop executes one or more tasks for a specified number of times. A For Loop could contain a FTP task that scans for files in a directory, followed by a Delay task that waits a couple minutes before reiterating the loop. The For Loop could continue to repeat up to a maximum number of iterations you specify.
Basic Tab
Label
The label displayed in the Project Outline.
Begin Index
This is the beginning index of the loop. The value can be any positive or negative whole number. The value must be less than or equal to End Index when Step is a positive number, and must be greater than or equal to End Index when Step is a negative number.
End Index
The ending index of the loop. The value can be any positive or negative whole number. The value must be greater than or equal to Begin Index when Step is a positive number, and must be less than or equal to Begin Index when Step is a negative number.
Step
The Step is how the current index of the loop should be stepped (incremented or decremented). The value can be any whole number. The loop will increment or decrement by this number from the Begin Index until the End Index is met.