Starting the pipeline

With the setup chores taken care of, you can now start the execution of your pipeline.

StepsTo start pipeline execution:

  1. Code the Start function in an appropriate script. In this function, you specify:

    • The Transaction object for the source database

    • The Transaction object for the destination database

    • The DataWindow control in which you want the Start function to display any error rows

      The Start function automatically associates the PowerBuilder pipeline-error DataWindow object with your DataWindow control when needed.

    • Values for retrieval arguments you have defined in the Pipeline object

      If you omit these values, the Start function prompts the user for them automatically at runtime.

  2. Test the result of the Start function.

For more information on coding the Start function, see the PowerScript Reference.

Example

The following sample code starts pipeline execution in the order entry application.

Calling the Start function When users want to start their selected pipeline, they click the cb_write CommandButton in the w_sales_extract window:

The operation area of the sample Write Extract Table screen shows the Create Quarterly Extract Table radio button checked. The Status area display for Database Connections displays Established.

This executes the Clicked event of cb_write, which contains the Start function:

// Now start piping.
integer li_start_result
li_start_result = iuo_pipe_logistics.Start &
   (itrans_source,itrans_destination,dw_pipe_errors)

Notice that the user did not supply a value for the pipeline’s retrieval argument (quarter). As a consequence, the Start function prompts the user for it:

A sample Specify Retrieval Arguments box displays the Argument as Quarter, the Type as Number, and a Value text box for entering the argument’s value.

Testing the result The next few lines of code in the Clicked event of cb_write check the Start function’s return value. This lets the application know whether it succeeded or not (and if not, what went wrong):

CHOOSE CASE li_start_result

   CASE -3
   Beep (1)
   MessageBox("Piping Error", &
      "Quarterly_Extract table already exists ...
   RETURN

   CASE -4
   Beep (1)
   MessageBox("Piping Error", &
      "Quarterly_Extract table does not exist ...
   RETURN
   ...
END CHOOSE