Branching in the Process Flow

In this section:

You want to be able to track success or failure when the data flow runs. You will do this by creating two procedures and including them in your process flow. Then you will supply the logic that invokes the appropriate one for the condition that is encountered.

Following the same modular model we have been using, you will create each of the stored procedures as a separate file that can be used in this process flow and others.


Top of page

x
Create the Procedures

First you will create a procedure that will appear in the log when the data flow executes correctly.

  1. Right-click the salesdemo application directory and choose New and Procedure.
  2. A text editing window opens. Enter the following line of code:
    -TYPE SUCCESS!
  3. Choose Save As from the File menu and name this procedure success. Click Save.
  4. Close the editing window.
  5. Now you will create a stored procedure that will appear in the log when the data flow fails to execute properly.

    Right-click the salesdemo application directory again, and choose New and Procedure.

  6. The text editing window opens. Enter the code:
    -TYPE FAILURE!
  7. Choose Save As from the File menu and name this procedure failure. Click Save.

    If applicable, this entry will be displayed in the DataMigrator log. Close the editing window.

    Both procedures are now listed in the salesdemo application directory.

    Application directory


Top of page

x
Connect the Procedures to the Data Flow

The Process Flow tab should now look like this:

Process flow

Next step: You have now created two branches from the data flow object to the procedures. Now you need to define the behavior associated with each branch of the flow. You will do that from the connector arrows.


Top of page

x
Specify Your Connection Logic

Follow-up actions based on the success or failure of the data flow execution are initiated by connection logic, in the form of return codes.

In the tutorial, we will use the default connection logic associated with the green and red arrows that branch to the stored procedures you created. Since these procedures write a line of code in the DataMigrator log, you will be able to see quickly which path the execution followed.

Tip: The implementation we have chosen to demonstrate can be built quickly and offers easily demonstrable results. However, there are many ways you can use branching within a process flow. For example:

Your options are many and varied.

Let us now review the default logic that will trigger the running of your two stored procedures.

  1. Double-click the green arrow connecting the data flow object to success. The Condition window opens.

    OK Default Condition (Return Code is 0) is selected by default, as shown below.

    Condition

  2. Click OK.
  3. Now, double-click the red arrow that connects to the failure procedure. This time, FAILED Default (Return Code is not 0) is selected by default.
  4. Click OK.

Next step: It is time to run the Process Flow to see the results, as reflected in the DataMigrator log.


iWay Software