ResetUpdate

Description

Clears the update flags in the primary and filter buffers and empties the delete buffer of a DataWindow or DataStore.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

integer dwcontrol.ResetUpdate ( ) 

Argument

Description

dwcontrol

The name of the DataWindow control, DataStore, or child DataWindow in which you want to reset the update flags


Return value

Returns 1 if it succeeds and -1 if an error occurs.

If dwcontrol is null, in PowerBuilder and JavaScript the method returns null.

Usage

When a row is changed, inserted, or deleted, its update flag is set, making it marked for update. By default the Update method turns these flags off. If you want to coordinate updates of more than one DataWindow or DataStore, however, you can prevent Update from clearing the flags. Then, after you verify that all the updates succeeded, you can call ResetUpdate for each DataWindow to clear the flags. If one of the updates failed, you can keep the update flags, prompt the user to fix the problem, and try the updates again.

You can find out which rows are marked for update with the GetItemStatus method. If a row is in the delete buffer or if it is in the primary or filter buffer and has NewModified! or DataModified! status, its update flag is set. After update flags are cleared, all rows have the status NotModified! or New! and the delete buffer is empty.

Examples

These statements coordinate the update of two DataWindow objects:

int rtncode
CONNECT USING SQLCA;
dw_cust.SetTransObject(SQLCA)
dw_sales.SetTransObject(SQLCA)
 
rtncode = dw_cust.Update(true, false)
IF rtncode = 1 THEN
      rtncode = dw_sales.Update(true, false)
      IF rtncode = 1 THEN
         dw_cust.ResetUpdate() // Both updates are OK
         dw_sales.ResetUpdate()// Clear update flags
         COMMIT USING SQLCA;   // Commit them
      ELSE
         ROLLBACK USING SQLCA; // 2nd update failed
      END IF
END IF

See also

Update