Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Repairing error rows – PB Docs 125 – PowerBuilder Library

Repairing error rows – PB Docs 125

Repairing error rows

In many situations it is appropriate to try fixing error rows
so that they can be applied to the destination table. Making these
fixes typically involves modifying one or more of their column values
so that the destination table will accept them. You can do this
in a couple of different ways:

  • By letting the user edit one
    or more of the rows in the error DataWindow control (the easy way
    for you, because it does not require any coding work)

  • By executing script code in
    your application that edits one or more of the rows in the error
    DataWindow control for the user

In either case, the next step is to apply the modified rows
from this DataWindow control to the destination table.

proc.png To apply row repairs to the destination table:

  1. Code
    the Repair function in an appropriate script.
    In this function, specify the Transaction object for the destination
    database.

  2. Test the result of the Repair function.

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

Example

In the following example, users can edit the contents of the dw_pipe_errors DataWindow
control to fix error rows that appear. They can then apply those modified
rows to the destination table.

Providing a CommandButton

When painting the w_sales_extract window, include
a CommandButton control named cb_applyfixes.
Then write code in a few of the application’s scripts to
enable this CommandButton when dw_pipe_errors contains
error rows and to disable it when no error rows appear.

Calling the Repair function

Next write a script for the Clicked event of cb_applyfixes.
This script calls the Repair function and tests
whether or not it worked properly:

Together, these features let a user of the application click
the cb_applyfixes CommandButton to
try updating the destination table with one or more corrected rows
from dw_pipe_errors.

Canceling row repairs

Earlier in this chapter you learned how to let users (or the
application itself) stop writing rows to the destination table during
the initial execution of a pipeline. If appropriate, you can use
the same technique while row repairs are being applied.

For details, see “Canceling pipeline
execution”
.

Committing row repairs

The Repair function commits (or rolls back)
database updates in the same way the Start function
does.

For details, see “Committing updates
to the database”
.

Handling rows that still are not repaired

Sometimes after the Repair function has
executed, there may still be error rows left in the error DataWindow
control. This may be because these rows:

  • Were modified by the user or application but still
    have errors

  • Were not modified by the user or application

  • Were never written to the destination table because
    the Cancel function was called (or were rolled
    back from the destination table following the cancellation)

At this point, the user or application can try again to modify
these rows and then apply them to the destination table with the Repair function.
There is also the alternative of abandoning one or more of these
rows. You will learn about that technique next.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x