Object | --Persistent | --Component | --DataSet
Located in File: /db.inc.php
A DataSet is a collection of information, organized in rows and fields, and this class implement the basic interface all data-aware components will use to show information.
A DataSet is not attached to an specific source of information, you can, for example, create a DataSet that provide information from a memory array.
![]() | LimitCount | Defines how many records will be shown |
![]() | LimitStart | Defines the starting record to filter the dataset with |
![]() | Active | Specifies whether or not a dataset is open. |
![]() | BOF | Indicates whether the first record in the dataset is active. |
![]() | CanModify | Indicates whether an application can insert, edit, and delete data in a table. |
![]() | DataSetField | Indicates the persistent DataSetField object that owns a nested dataset. |
![]() | EOF | Indicates whether a dataset is positioned at the last record. |
![]() | FieldCount | Indicates the number of field components associated with the dataset. |
![]() | Fields | This property returns an array with the field names and values |
![]() | Filter | Specifies the text of the current filter for a dataset. |
![]() | MasterFields | Specifies one or more fields in a master table to link with corresponding fields in this table in order to establish a master-detail relationship between the tables. |
![]() | MasterSource | Specifies the name of the data source for a dataset to use as a master table in establishing a detail-master relationship between this table and another one. |
![]() | Modified | Indicates whether the active record is modified. |
![]() | RecKey | Specifies the record key for this dataset |
![]() | RecNo | Indicates the current record in the dataset. |
![]() | RecordCount | Indicates the total number of records associated with the dataset. |
![]() | State | Indicates the current operating mode of the dataset. |
Defined in class Component |
||
![]() | Name | Specifies the name for the component. The name is used as an identifier and should be unique. |
![]() | Tag | A versatile property of every Component that can be used in any way you want |
![]() | ComponentCount | Indicates the number of components owned by the component. |
![]() | Components | Lists all the components owned by this component. |
![]() | ControlState | A flag to know the state of the control, csLoading, csDesigning |
![]() | DataFieldValue | This property returns the value of the datafield if any. |
![]() | NamePath | Specifies the path to uniquely identify a component, qualified by the owner when required. |
![]() | Owner | Indicates the component that is responsible for streaming and freeing this component. |
Defined in class Persistent |
||
![]() | NamePath | Used to serialize/unserialize. It returns the full path to identify this component. |
![]() | Owner | Owner of the component. |
property LimitCount (line 582)
Use this property to set how many records do you want to get on the set, at max.
property LimitStart (line 568)
Use this property to filter the dataset and to set which is the first record to be added to the set.
property Active (line 2302)
Use Active to determine or set whether a dataset is populated with data. When Active is false, the dataset is closed; the dataset cannot read or write data and data-aware controls can not use it to fetch data or post edits. When Active is true, the dataset can be populated with data. It can read data from a database or other source (such as a provider). Depending on the CanModify property, active datasets can post changes.
Setting Active to true:
Generates a OnBeforeOpen event.
Sets the dataset state to dsBrowse.
Establishes a way to fetch data (typically by opening a cursor).
Generates an OnAfterOpen event.
If an error occurs while opening the dataset, dataset state is set to dsInactive, and any cursor is closed.
Setting Active to false:
3 - Closes the cursor.
4 - Triggers an AfterClose event.
An application must set Active to false before changing other properties that affect the status of a database or the controls that display data in an application.
Note: Calling the Open method sets Active to true; calling the Close method sets Active to false.
property BOF (line 2389)
Test Bof (beginning of file) to determine if the dataset is positioned at the first record. If Bof is true, the active record is unequivocally the first row in the dataset. Bof is true when an application.
Opens a dataset.
Calls a dataset’s First method.
Call a dataset’s Prior method, and the method fails because the first row is already active.
Bof is false in all other cases.
property CanModify (line 881)
Check the status of CanModify to determine if an application can modify a dataset in any way. If CanModify is true, the dataset can be modified. If CanModify is false, the table is read-only.
CanModify is set automatically when an application opens a table. If the ReadOnly property of a table component is true, then CanModify is set to false.
Note: Even if CanModify is true, it is not a guarantee that a user will be able to insert or update records in a table. Other factors may come in to play, for example, SQL access privileges.
property DataSetField (line 685)
Not used.
property EOF (line 2415)
Test Eof (end-of-file) to determine if the active record in a dataset is the last record. If Eof is true, the current record is unequivocally the last row in the dataset. Eof is true when an application:
Opens an empty dataset.
Calls a dataset’s Last method. (Unless it is a unidirectional dataset)
Call a dataset’s Next method, and the method fails because the current record is already the last row in the dataset.
Eof is false in all other cases.
Tip: If both Eof and Bof are true, the dataset is empty.
property FieldCount (line 662)
Examine FieldCount to determine the number of fields listed by the Fields property.
property Fields (line 653)
Use Fields to access fields that make up this dataset. The order of field components in Fields corresponds directly to the order of columns in the table or tables underlying a dataset.
Accessing fields with the Fields property is useful for applications that:
Iterate over some or all fields in a dataset.
Work with underlying tables whose internal data structure is unknown at runtime.
If an application knows the data types of individual fields, then it can read or write individual field values through the Fields property.
property Filter (line 1175)
Use Filter to specify a dataset filter. When filtering is applied to a dataset, only those records that meet a filter’s conditions are available. Filter describes the filter condition.
property MasterFields (line 732)
Use MasterFields after setting the MasterSource property to specify the names of one or more fields to use in establishing a detail-master relationship between this table and the one specified in MasterSource.
MasterFields is an array containing one or more field names in the master table.
Each time the current record in the master table changes, the new values in those fields are used to select corresponding records in this table for display.
property MasterSource (line 756)
Use MasterSource to specify the name of the data source component whose DataSet property identifies a dataset to use as a master table in establishing a detail-master relationship between this table and another one.
Note: At design time choose an available data source from the MasterSource property’s drop-down list in the Object Inspector.
After setting the MasterSource property, specify which fields to use in the master table by setting the MasterFields property. At runtime each time the current record in the master table changes, the new values in those fields are used to select corresponding records in this table for display.
property Modified (line 857)
Check Modified to determine if the active record is modified. If Modified is true, the active record is modified. If false, the active record is not modified.
Note: In general, an application need not check the status of Modified. Properties, events, and methods of TDataSet and its descendants that modify records generally check this status automatically and take appropriate actions based on its value.
property RecKey (line 803)
This property specifies the fields and values that determine the key of a record.
property RecNo (line 776)
Examine RecNo to determine the record number of the current record in the dataset. Applications might use this property with RecordCount to iterate through all the records in a dataset, though typically record iteration is handled with calls to First, Last, MoveBy, Next, and Prior.
property RecordCount (line 1761)
As implemented in DataSet, RecordCount is always 0. Ordinarily an application does not access RecordCount at the DataSet level. Instead a redeclared and implemented RecordCount property in a descendant class is accessed. RecordCount provides a fallback property for derived dataset classes that do not reimplement the property access method.
property State (line 706)
Examine State to determine the current operating mode of the dataset. State determines what can be done with data in a dataset, such as editing existing records or inserting new ones. The dataset state constantly changes as an application processes data.
Opening a dataset changes State from dsInactive to dsBrowse. An application can call Edit to put a dataset into dsEdit state, or call Insert to put a dataset into dsInsert state.
Posting or canceling edits, insertions, or deletions, changes State from its current state to dsBrowse. Closing a dataset changes its state to dsInactive.
property Name
property Tag
property ComponentCount
property Components
property ControlState
property DataFieldValue
property NamePath
property Owner
property NamePath
| __construct | Component constructor [Overrides Component::__construct()] |
| append | Adds a new, empty record to the end of the dataset. |
| beginInsertAppend | Begins an insert/append operation |
| cancel | Cancels modifications to the active record if those changes are not yet posted. |
| checkActive | Checks to see if the database connection is active. |
| checkBrowseMode | Automatically posts or cancels data changes when the active record changes. |
| checkCanModify | Checks to see if the dataset can be modified. |
| checkOperation | Checks if an specific operation can be made, if not, calls $ErrorEvent |
| checkParentState | Sets the parent dataset in edit state |
| clearBuffers | Clear buffers associated with the dataset |
| close | Closes a dataset. |
| closeCursor | Close the cursor for this dataset |
| controlsDisabled | Indicates whether data-aware controls update their display to reflect changes to the dataset. |
| dataEvent | Used to notify attached datasets about an specific event |
| delete | Deletes the active record and positions the dataset on the next record. |
| DisableControls | Disables data display in data-aware controls associated with the dataset. |
| doInternalOpen | Performs an internal open of the dataset |
| edit | Enables editing of data in the dataset. |
| EnableControls | Enable controls attached to the datasource |
| endInsertAppend | Finishes an insert/append operation |
| first | Moves to the first record in the dataset. |
| initRecord | To initialize the current record |
| insert | Inserts a new, empty record in the dataset. |
| internalCancel | To be overriden to perform a cancel() operation |
| internalClose | Override this method to perform the closing of the dataset |
| internalDelete | To be overriden to perform a delete() operation |
| internalEdit | To be overriden to perform a edit() operation |
| internalFirst | To be overriden to perform a first() operation |
| internalHandleException | Override this method to handle exceptions |
| internalInitFieldDefs | Override this method to init field definitions. Not used. |
| internalInsert | To be overriden to perform a insert() operation |
| internalLast | To be overriden to perform a last() operation |
| internalOpen | Override this method to perform the opening of the dataset |
| internalPost | To be overriden to perform a post() operation |
| internalRefresh | To be overriden to perform a refresh() operation |
| isCursorOpen | Override this method to return if the cursor is open or not |
| last | Moves to the last record in the dataset. |
| loaded | Initializes the component after the form file has been read into memory. [Overrides Component::loaded()] |
| moveBy | Moves to another record relative to the active record in the dataset. |
| next | Moves to the next record in the dataset. |
| open | Opens the dataset. |
| openCursor | Opens the cursor for the dataset |
| OpenCursorComplete | Finishes the open cursor operation |
| post | Implements a virtual method to write a modified record to the database or change log. |
| prior | Moves to the previous record in the dataset. |
| refresh | Re-fetches data from the database to update a dataset’s view of data. |
| serialize | Stores this object into the session. [Overrides Persistent::serialize()] |
| unserialize | This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call. [Overrides Persistent::unserialize()] |
| updateRecord | Ensures that data-aware controls and detail datasets reflect record updates. |
Defined in class Component |
||
![]() | dumpChildrenJavascript | Dumps the javascript code for all the children |
![]() | dumpFormItems | Dumps code just after the form tag, useful to dump hidden fields for state retrieving for non visible components |
![]() | dumpHeaderCode | Dumps header code required |
![]() | dumpJavascript | Dumps the javascript code needed by this component |
![]() | hasValidDataField | Returns true if a valid data field is attached to the component |
![]() | init | Initializes a component |
![]() | loaded | Initializes the component after the form file has been read into memory. |
![]() | loadedChildren | Calls childrens loaded |
![]() | preinit | Method called before init() |
![]() | serializeChildren | Serializes all children |
![]() | unserializeChildren | Unserializes all children by calling unserialize for all the components |
Defined in class Persistent |
||
![]() | serialize | Stores this object into the session. |
![]() | unserialize | This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call. |
Defined in class Object |
||
![]() | __construct | Constructs an object and initializes its data before the object is first used. |
![]() | className | Returns a string indicating the type of the object instance (as opposed to the type of the variable passed as an argument). |
![]() | classParent | Returns the type of the immediate ancestor of a class. |
Constructor __construct (line 1470)
Overrides : Component::__construct() Component constructor
Method append (line 1519)
For datasets that permit editing, call Append to:
Method beginInsertAppend (line 1434)
This method is called by the dataset to start an insert or append operation, it first checks the browse mode, after that, checks if the dataset can be modified and finally, calls the OnBeforeInsert event
Method cancel (line 1546)
Call Cancel to undo modifications made to one or more fields belonging to the active record. As long as those changes are not already posted, Cancel returns the record to its previous state, and sets the dataset state to dsBrowse.
Typically Cancel is used to back out of changes in response to user request, or in field validation routines that back out illegal field values.
Note: If the dataset is not in an editing state (dsEdit or dsInsert), Cancel does nothing.
Method checkActive (line 1305)
Call CheckActive to determine if the connection to a database server is active. If the database connection is inactive, an DatabaseError exception is raised.
Method checkBrowseMode (line 1608)
CheckBrowseMode is used internally by many dataset methods to ensure that modifications to the active record are posted when a dataset’s state is dsEdit, dsInsert, or dsSetKey and a method switches to a different record.
If State is dsEdit or dsInsert, CheckBrowseMode calls UpdateRecord, and, if the Modified property for the dataset is true, calls Post. If Modified is false, CheckBrowseMode calls Cancel.
If State is dsSetKey, CheckBrowseMode calls Post.
If State is dsInactive, CheckBrowseMode raises an exception.
If an application uses existing dataset methods, CheckBrowseMode is always called when necessary, so there is usually no need to call CheckBrowseMode directly.
Applications that provide custom dataset routines may need to call CheckBrowseMode inside those routines to guarantee that changes are posted when switching to a different record.
Method checkCanModify (line 1318)
Call CheckCanModify to determine if the dataset can be modified. If the dataset cannot be modified, an DatabaseError exception is raised.
Method checkOperation (line 1222)
Method checkParentState (line 1697)
This is an internal method you don't need to call directly.
Method clearBuffers (line 1415)
This method set the dataset buffers to the inital state, that is, recordcount to 0 and bof/eof to true. The fieldbuffer is also cleared to an empty array.
Method close (line 1644)
Call Close to set the Active property of a dataset to false. When Active is false, the dataset is closed; it cannot read or write data and data-aware controls can’t use it to fetch data or post edits.
An application must close the dataset before changing properties that affect the status of the database or the controls that display data in an application. For example, to change the DataSource property for a dataset, the dataset must be closed. Closing the dataset puts it into the dsInactive state.
Method closeCursor (line 1908)
This method is used to close the cursor attached to the dataset, it calls InternalClose, a method you need to override if you are deriving from Dataset.
Method controlsDisabled (line 1342)
Call ControlsDisabled to ascertain whether the updating of data display in data-aware controls is currently disabled. If ControlsDisabled is true, controls are currently disabled. ControlsDisabled is true as long as the reference count that keeps track of disabling for the dataset is greater than zero. This count is incremented every time the DisableControls method is called and decremented when EnableControls is called. Applications call DisableControls to improve performance and prevent constant updates during automated iterations through records in the dataset.
In complex applications, when controls may be disabled multiple times by different processes, you can use ControlsDisabled as a check in a procedure to reenable controls should each call to DisableControls not be paired with a subsequent call to EnableControls.
Method dataEvent (line 1251)
Method delete (line 1674)
Call Delete to remove the active record from the database. If the dataset is inactive, Delete raises an exception. Otherwise, Delete:
Verifies that the dataset is not empty (and raises an exception if it is).
Calls CheckBrowseMode to post any pending changes to a prior record if necessary.
Calls the OnBeforeDelete event handler.
Deletes the record.
Frees any buffers allocated for the record.
Puts the dataset into dsBrowse mode.
Resynchronizes the dataset to make the next undeleted record active. If the record deleted was the last record in the dataset, then the previous record becomes the current record.
Calls the AfterDelete event handler.
Method DisableControls (line 1373)
Call DisableControls prior to iterating through a large number of records in the dataset to prevent data-aware controls from updating every time the active record changes. Disabling controls speeds performance because data does not need to be processed by data-aware controls.
If controls are not already disabled, DisableControls records the current state of the dataset, broadcasts the state change to all associated data-aware controls and detail datasets, and increments the dataset’s disabled count variable. Otherwise, DisableControls just increments the disabled count variable.
The disabled count is used internally to determine whether to display data in data-aware controls. When the disable count variable is greater than zero, data is not updated.
If the dataset is the master of a master/detail relationship, calling DisableControls also disables the master/detail relationship.
Note: Calls to DisableControls can be nested. Only when all calls to DisableControls is matched to a corresponding call to EnableControls does the dataset update data controls and detail datasets.
Method doInternalOpen (line 1834)
This is method called by the dataset to perform an open of the data. It calls InternalOpen, a method you should implement if you are deriving from Dataset.
Method edit (line 1727)
Call Edit to permit editing of the active record in a dataset. Edit determines the current state of the dataset. If the dataset is empty, Edit calls Insert. Otherwise Edit:
Calls CheckBrowseMode to post any pending changes to a prior record if necessary.
Checks the CanModify property and raises an exception if the dataset can’t be edited.
Calls the OnBeforeEdit event handler.
Retrieves the record.
Puts the dataset into dsEdit state, enabling the application or user to modify fields in the record.
Broadcasts the state change to associated controls.
Calls the OnAfterEdit event handler.
Modifications will go to a buffer waiting for post()/cancel()
Method EnableControls (line 1395)
Call EnableControls to permit data display in data-aware controls after a prior call to DisableControls. EnableControls decrements the disabled count variable for the dataset if it is not already zero. If the disable count variable is zero, EnableControls updates the current state of the dataset, if necessary, and then tells associated controls to re-enable display.
Method endInsertAppend (line 1451)
This method is called by a dataset to finish an insert or append operation. It sets the dataset in insert state, calls the OnNewRecord event and finally calls the OnAfterInsert.
Method first (line 1791)
Call First to make the first record in the dataset active. First posts any changes to the active record and:
Clears the record buffers.
Fetches the first record and makes it the active record.
Fetches any additional records required for display, such as those needed to fill out a grid control.
Sets the Bof property to true.
Broadcasts the record change so that data controls and linked detail sets can update.
Note: DataSet uses internal, protected methods to reposition the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the First method to work.
Method initRecord (line 1951)
Method insert (line 1490)
Call Insert to:
Method internalAddRecord (line 1962)
Method internalCancel (line 1999)
This method is called when a cancel operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method internalClose (line 595)
This method is called internally by the engine to close the dataset. Is not intended to be called directly the component user.
Method internalDelete (line 1974)
This method is called when a delete operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method internalEdit (line 2011)
This method is called when a edit operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method internalFirst (line 1928)
This method is called when a first operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method internalHandleException (line 605)
This method is called internally by the engine to handle an exception using the dataset.
Is not intended to be called directly the component user.
Method internalInitFieldDefs (line 610)
Method internalInsert (line 2023)
This method is called when a insert operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method internalLast (line 1940)
This method is called when a last operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method internalOpen (line 621)
This method is called internally by the engine to open the dataset. Is not intended to be called directly the component user.
Method internalPost (line 1986)
This method is called when a post operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method internalRefresh (line 2035)
This method is called when a refresh operation is atempted, so if you are creating new types of datasets, you need to override this method.
Method isCursorOpen (line 633)
This method is called internally by the engine to determine if the cursor is open or not.
Is not intended to be called directly the component user.
Method last (line 2062)
Call Last to make the last record in the dataset active. Last posts any changes to the active record and
Clears the record buffers.
Fetches the last record and makes it the active record.
Fetches any additional records required for display, such as those needed to fill out a grid control.
Sets the Eof property to true.
Broadcasts the record change so that data controls and linked detail sets can update.
Note: DataSet uses internal, protected methods to reposition the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the Last method to work.
Method loaded (line 2313)
Overrides : Component::loaded() Initializes the component after the form file has been read into memory.
Method moveBy (line 2221)
Call MoveBy to move the active record by the number of records specified by Distance. A positive value for Distance indicates forward progress through the dataset, while a negative value indicates backward progress.
MoveBy posts any changes to the active record and
Sets the Bof and Eof properties to false.
If Distance is positive, repeatedly fetches Distance subsequent records (if possible), and makes the last record fetched active. If an attempt is made to move past the end of the file, MoveBy sets Eof to true.
If Distance is negative, repeatedly fetches the appropriate number of previous records (if possible), and makes the last record fetched active. If an attempt is made to move past the start of the file, MoveBy sets Bof to true. If the dataset is unidirectional, the dataset raises an EDatabaseError exception when MoveBy tries to fetch a prior record.
Broadcasts information about the record change so that data-aware controls and linked datasets can update.
Method next (line 2126)
Call Next to move to the next record in the dataset, making it the active record. Next posts any changes to the active record and
Sets the Bof and Eof properties to false.
Fetches the next record and makes it the active record.
Fetches any additional records required for display, such as those needed to fill out a grid control.
Sets the Eof property to true if the last record in the dataset was already active.
Broadcasts the record change so that data controls and linked detail sets can update.
Note: DataSet uses internal, protected methods to move the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the Next method to work.
Method open (line 2156)
Call Open to set the Active property for the dataset to true. When Active is true, dataset can be populated with data. It can read data from a database or other source (such as a provider). Depending on the CanModify property, active datasets can post changes.
Setting Active to true:
Triggers the OnBeforeOpen event handler if one is defined for the dataset.
Sets the dataset state to dsBrowse.
Establishes a way to fetch data (typically by opening a cursor).
Triggers the After Open event handler if one is defined for the dataset.
If an error occurs during the dataset open, dataset state is set to dsInactive, and any cursor is closed.
Method openCursor (line 1853)
This method is called to open the cursor for this dataset by calling DoInternalOpen.
Method OpenCursorComplete (line 1867)
This method is called when opening a cursor to complete the open operation, it first calls DoInternalOpen and fires the OnAfterOpen event.
Method post (line 2173)
DataSet implements a virtual method to write a modified record to the database or change log. Dataset methods that change the dataset state, such as Edit, Insert, or Append, or that move from one record to another, such as First, Last, Next, and Prior automatically call Post.
Designers of custom datasets can choose whether to implement Post by writing records to the database server or to an internal change log.
Method prior (line 2251)
Call Prior to move to the previous record in the dataset, making it the active record. Prior posts any changes to the active record and
Sets the Bof and Eof properties to false.
Fetches the previous record and makes it the active record. If the dataset is unidirectional, it raises an EDatabaseError exception at this point.
Fetches any additional records required for display, such as those needed to fill out a grid control.
Sets the Bof property to true if the first record in the dataset was already active.
Broadcasts the record change so that data controls and linked detail sets can update.
Note: DataSet uses internal, protected methods to move the active record and to fetch additional records required for display. In DataSet, these internal methods are empty stubs. Descendant classes implement these methods to enable the Prior method to work.
Method refresh (line 2098)
Call Refresh to ensure that an application has the latest data from a database. For example, when an application turns off filtering for a dataset, it should immediately call Refresh to display all records in the dataset, not just those that used to meet the filter condition.
DataSet generates a OnBeforeRefresh event before refreshing the records and an OnAfterRefresh event afterwards.
Warning: Dataset refresh the data by closing and reopening the cursor. This can have unintended side effects if, for example, you have code in the OnBeforeClose, OnAfterClose, OnBeforeOpen, or OnAfterOpen event handlers.
Method serialize (line 807)
Overrides : Persistent::serialize() Stores this object into the session.
Method unserialize (line 826)
Overrides : Persistent::unserialize() This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call.
Method updateRecord (line 1579)
UpdateRecord is used internally by some dataset methods to inform data-aware controls of updates and trigger an OnUpdateRecord event if updates are enabled. Applications should not need to call UpdateRecord directly unless they provide custom dataset methods that bypass DataSet methods.
![]() | OnAfterCancel | Occurs after an application completes a request to cancel modifications to the active record. |
![]() | OnAfterClose | Occurs after an application closes a dataset. |
![]() | OnAfterDelete | Occurs after an application deletes a record. |
![]() | OnAfterEdit | Occurs after an application starts editing a record. |
![]() | OnAfterInsert | Occurs after an application inserts a new record. |
![]() | OnAfterOpen | Occurs after an application completes opening a dataset and before any data access occurs. |
![]() | OnAfterPost | Occurs after an application writes the active record to the database or change log and returns to browse state. |
![]() | OnBeforeCancel | Occurs before an application executes a request to cancel changes to the active record. |
![]() | OnBeforeClose | Occurs immediately before the dataset closes. |
![]() | OnBeforeDelete | Occurs before an application attempts to delete the active record. |
![]() | OnBeforeEdit | Occurs before an application enters edit mode for the active record. |
![]() | OnBeforeInsert | Occurs before an application enters insert mode. |
![]() | OnBeforeOpen | Occurs before an application executes a request to open a dataset. |
![]() | OnBeforePost | Occurs before an application posts changes for the active record to the database or change log. |
![]() | OnCalcFields | Occurs when an application recalculates calculated fields. |
![]() | OnDeleteError | Not used, reserved for future use |
![]() | OnFilterRecord | Not used, reserved for future use |
![]() | OnNewRecord | Not used, reserved for future use |
![]() | OnPostError | Not used, reserved for future use |
property OnAfterCancel (line 1103)
Write an OnAfterCancel event handler to take specific action after an application cancels changes to the active record. OnAfterCancel is called by the Cancel method after it updates the current position, releases the lock on the active record if necessary, and sets the dataset state to dsBrowse. If an application requires additional processing before returning control to a user after a Cancel event, code it in the OnAfterCancel event.
property OnAfterClose (line 955)
Write an OnAfterClose event handler to take specific action immediately after an application closes a dataset.
OnAfterClose is called after a dataset is closed and the dataset state is set to dsInactive.
property OnAfterDelete (line 1138)
Write an OnAfterDelete event handler to take specific action immediately after an application deletes the active record in a dataset. OnAfterDelete is called by Delete after it deletes the record, sets the dataset state to dsBrowse, and repositions the current record.
property OnAfterEdit (line 1025)
Write an OnAfterEdit event handler to take specific action immediately after dataset enters edit mode. OnAfterEdit is called by Edit after it enables editing of a record, recalculates calculated fields, and calls the data event handler to process a record change.
property OnAfterInsert (line 989)
Write an OnAfterInsert event handler to take specific action immediately after an application inserts a record. The Insert and Append methods generate an OnAfterInsert event after inserting or appending a new record.
property OnAfterOpen (line 919)
Write an AfterOpen event handler to take specific action immediately after an application opens the dataset. AfterOpen is called after the dataset establishes access to its data and the dataset is put into dsBrowse state. For example, an AfterOpen event handler might check an ini file to determine the last record touched in the dataset the previous time the application ran, and position the dataset at that record.
property OnAfterPost (line 1064)
Write an OnAfterPost event handler to take specific action immediately after an application posts a change to the active record. OnAfterPost is called after a modification or insertion is made to a record.
property OnBeforeCancel (line 1083)
Write a OnBeforeCancel event to take specific action before an application carries out a request to cancel changes. OnBeforeCancel is called by the Cancel method before it cancels a dataset operation such as Edit, Insert, or Delete.
An application might use the OnBeforeCancel event to record a user’s changes in an undo buffer.
property OnBeforeClose (line 936)
Write a OnBeforeClose event to take specific action before an application closes a dataset. Calling Close or setting the Active property to false results in a call to the OnBeforeClose event handler.
property OnBeforeDelete (line 1120)
Write a BeforeDelete event handler to take specific action before an application deletes the active record. OnBeforeDelete is called by Delete before it actually deletes a record.
property OnBeforeEdit (line 1007)
Write a OnBeforeEdit event handler to take specific action before an application enables editing of the active record. For example, an application that keeps a log of database edits could use the OnBeforeEdit event to record the edit request, time, and user before entering edit state.
property OnBeforeInsert (line 972)
Write a OnBeforeInsert event handler to take specific action before an application inserts or appends a new record. The Insert or Append method generates a OnBeforeInsert method before it sets the dataset into dsInsert state.
property OnBeforeOpen (line 899)
Write a OnBeforeOpen event handler to take specific action before an application opens a dataset for viewing or editing. OnBeforeOpen is triggered when an application sets the Active property to true for a dataset or an application calls Open.
property OnBeforePost (line 1047)
Write a OnBeforePost event handler to take specific action before an application posts dataset changes. OnBeforePost is triggered when an application calls the Post method. Post checks to make sure all required fields are present, then calls OnBeforePost before posting the record.
An application might use OnBeforePost to perform validity checks on data changes before committing them. If it encountered a validity problem, it could call Abort to cancel the Post operation.
property OnCalcFields (line 1151)
(not used)