ResetUpdate method (DataWindows)
Description
Clears the update flags in the primary and filter buffers
and empties the delete buffer of a DataWindow or DataStore.
Controls
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
Web |
Server component |
Web ActiveX |
DataWindow control, DataWindowChild object |
Syntax
[PowerBuilder]
1 |
integer <span>dwcontrol</span>.<span>ResetUpdate</span> ( ) |
[Web DataWindow server component]
1 |
short <span>dwcontrol</span>.<span>ResetUpdate</span> ( ) |
[Web ActiveX]
1 |
number <span>dwcontrol</span>.<span>ResetUpdate</span> ( ) |
Argument |
Description |
---|---|
dwcontrol |
The name of the DataWindow control, DataStore, |
Return Values
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:
1 |
int rtncode |
1 |
CONNECT USING SQLCA; |
1 |
dw_cust.SetTransObject(SQLCA) |
1 |
dw_sales.SetTransObject(SQLCA) |
1 |
1 |
rtncode = dw_cust.Update(true, false) |
1 |
IF rtncode = 1 THEN |
1 |
rtncode = dw_sales.Update(true, false) |
1 |
IF rtncode = 1 THEN |
1 |
dw_cust.<span>ResetUpdate</span>() // Both updates are OK |
1 |
dw_sales.<span>ResetUpdate</span>()// Clear update flags |
1 |
COMMIT USING SQLCA;   // Commit them |
1 |
ELSE |
1 |
ROLLBACK USING SQLCA; // 2nd update failed |
1 |
END IF |
1 |
END IF |