Mastering PowerBuilder

HomePrevious Lesson: Defining the Data Pipeline Object
Next Lesson: Pipeline Object At Work

Defining Pipeline User Object

As explained earlier, in order to execute the data pipeline object at run-time, you need to use pipeline user object.

Invoke the user object painter and select Standard under the Class option and click OK button. Select pipeline from the list of standard classes and click OK button. This object has three major event.

When you execute this object using Start() function, PipeStart event fires. For each row pipeline acts in the target table, PipeMeter event fires. At the end PipeEnd event fires. For our example, what we can do is, display the number of rows being copied as each row is copied to the target table. That means, we need to write the script in the PipeMeter event.

Declare three instance variables as shown below. We will be using these variable to display the status.
StaticText st_read, st_written, st_errors

Write the following code to the PipeMeter event.
If IsValid( st_read ) THEN st_read.text = string( RowsRead )
If IsValid(st_written) THEN st_written.text = string( RowsWritten)
If IsValid( st_errors ) THEN st_errors.text = string( RowsInError)

Save the object as "uo_p_copy_to_history" and exit the painter. Observe that, we have just declared the variables, but we are neither creating those variables using the CREATE statement not assigning any objects to this variables. We will be assigning the objects before we execute this object.
HomePrevious Lesson: Defining the Data Pipeline Object
Next Lesson: Pipeline Object At Work