Adding Conditional Statements

About this task

Conditional statements branch processing within a Process, based on the result of a previous Process step. For example, when a Process copies a file, a conditional statement can test if the copy was successful. If the copy was successful, the Process continues processing additional steps. If the copy was unsuccessful, the Process can call a user-defined program that sends an error message to the console and stops processing.

Conditional processing tests against the completion code of the previous step. Conditional steps can be nested so that a Process can test for multiple results and react accordingly.

This procedure shows how to create a simple conditional statement that tests if a copy was successful. If the copy was successful, the Process executes the next statement.

Procedure

  1. From the Process menu, select Insert > If to add an If statement to a Process.
  2. Type CHECK1 as the label for this step in the If Statement Label field.
  3. Select COPY1 as the step label to test against from the list box.
  4. Select EQ as the comparison statement in the Operator field.
  5. Select 0 in the Value field to check if the copy process was successfully performed.
  6. Click OK to save the statement. The If statement is displayed in the Process window.
  7. To add the End If statement, from the Process menu, select Insert > End If.
  8. Click OK to save the statement. The Endif statement is displayed in the Process window.