Reset

Description

Clears all the data from a DataWindow control or DataStore object.

For the syntax to use for deleting graphs within a DataWindow object that have an external data source, see Reset. For the syntax to use with other PowerBuilder controls, see Reset in the PowerScript Reference.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object

Web

Server component

Web ActiveX

DataWindow control, DataWindowChild object

Syntax

PowerBuilder

integer dwcontrol.Reset ( ) 

Web DataWindow server component

short dwcontrol.Reset ( )

Web ActiveX

number dwcontrol.Reset ( ) 

Argument

Description

dwcontrol

A reference to a DataWindow control, DataStore, or child DataWindow

Returns

Returns 1 if it succeeds and –1 if an error occurs. The return value is usually not used.

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

Usage

Reset is not the same as deleting rows from the DataWindow object or child DataWindow. Reset affects the application only, not the database. If you delete rows and then call the Update method, the rows are deleted from the database table associated with the DataWindow object. If you call Reset and then call Update, no changes are made to the table.

NotePowerBuilder environment If you call Reset when the Retrieve As Needed option is set, Reset will clear the rows that have been retrieved. However, because Retrieve As Needed is on, the DataWindow immediately retrieves the next set of rows.

To prevent the rows from being retrieved, call DBCancel before calling Reset. If all the rows have been retrieved (the cursor has been closed and the RetrieveEnd event has occurred), then when Reset clears the DataWindow, it stays empty.

Examples

Example 1

This statement completely clears the contents of dw_employee:

dw_employee.Reset()

Example 2

In a DataWindow whose Retrieve As Needed option is on, this example cancels the retrieval before resetting the DataWindow:

dw_employee.DBCancel()

dw_employee.Reset()

See also