Determining Dataset States

From RAD Studio
Jump to: navigation, search

Go Up to Understanding Datasets Index


The state - or mode - of a dataset determines what can be done to its data. For example, when a dataset is closed, its state is dsInactive, meaning that nothing can be done to its data. At runtime, you can examine a dataset read-only State property to determine its current state. The following table summarizes possible values for the State property and what they mean:

Values for the dataset State property:

Value State Meaning

dsInactive

Inactive

DataSet closed. Its data is unavailable.

dsBrowse

Browse

DataSet open. Its data can be viewed, but not changed. This is the default state of an open dataset.

dsEdit

Edit

DataSet open. The current row can be modified. (not supported on unidirectional datasets)

dsInsert

Insert

DataSet open. A new row is inserted or appended. (not supported on unidirectional datasets)

dsSetKey

SetKey

DataSet open. Enables setting of ranges and key values used for ranges and GotoKey operations. (not supported by all datasets)

dsCalcFields

CalcFields

DataSet open. Indicates that an OnCalcFields event is under way. Prevents changes to fields that are not calculated.

dsCurValue

CurValue

DataSet open. Indicates that the CurValue property of fields is being fetched for an event handler that responds to errors in applying cached updates.

dsNewValue

NewValue

DataSet open. Indicates that the NewValue property of fields is being fetched for an event handler that responds to errors in applying cached updates.

dsOldValue

OldValue

DataSet open. Indicates that the OldValue property of fields is being fetched for an event handler that responds to errors in applying cached updates.

dsFilter

Filter

DataSet open. Indicates that a filter operation is under way. A restricted set of data can be viewed, and no data can be changed. (not supported on unidirectional datasets)

dsBlockRead

Block Read

DataSet open. Data-aware controls are not updated and events are not triggered when the current record changes.

dsInternalCalc

Internal Calc

DataSet open. An OnCalcFields event is underway for calculated values that are stored with the record. (client datasets only)

dsOpening

Opening

DataSet is in the process of opening but has not finished. This state occurs when the dataset is opened for asynchronous fetching.



Typically, an application checks the dataset state to determine when to perform certain tasks. For example, you might check for the dsEdit or dsInsert state to ascertain whether you need to post updates.

Note: Whenever a dataset state changes, the OnStateChange event is called for any data source components associated with the dataset. For more information about data source components and OnStateChange, see Responding to Changes Mediated by the Data Source.

See Also