Table
Reference documentation for a Table object
Overview
A Table object represents an individual table in a Database Server.
File Structure
The properties for a Table are stored under in the resources directory in a Database Information (.dbi) File.
Properties Summary
The following properties can be configured for a Table object
Use this property to hide the table from the Servoy Developer environment
isMetadataTable
Returns whether table was flagged as metadata table
Events Summary
The following events can be handled for a Table object.
occurs prior to a new record being inserted into the table
occurs prior to an existing record being updated in the database
occurs prior to an existing record being deleted from the database
occurs subsequent to a new record being inserted into the table
occurs subsequent to an existing record being updated in the database
occurs subsequent to an existing record being deleted from the database
occurs prior to a new record being created in the foundset
occurs prior to the foundset going into find mode
occurs prior to executing a search on the foundset
occurs subsequent to the creation of a new record
occurs subsequent to entering find mode
occurs subsequent to performing the search for a foundset
occurs before an insert operation, it can block the insert operation by returning false
Properties Details
The following properties can be configured for a Table object
hiddenInDeveloper
Use this property to hide the table from the Servoy Developer environment. When set to true, the table will be skipped when loading information about the database schema.
Type: String
Required: false
Events Details
onRecordInsert
This event is a pre-trigger for a record insert. It is fired during a save event and gives the developer a chance to validate the record or make changes. Return false or assign error markers to prevent the insert.
Parameters
record: JSRecord - The record that will be inserted
recordMarkers: JSRecordMarkers - The object where all the problems can be reported
stateObject: Object - An object that a user can give to validateRecord for extra state (optional, can be null).
Returns: Boolean - Return false to prevent the record from being inserted.
Example
onRecordUpdate
This event is a pre-trigger for a record update. It is fired during a save event and gives the developer a chance to validate the record to be updated. Return false or assign error markers to prevent the update.
Parameters
record: JSRecord - The record that will be updated
recordMarkers: JSRecordMarkers - The object where all the problems can be reported
stateObject: Object - An object that a user can give to validateRecord for extra state (optional, can be null).
Returns: Boolean - Return false to prevent the record from being update.
Example
onRecordDelete
This event is a pre-trigger for a record deletion. It is fired during a save event and gives the developer a chance to validate the record to be daleted. Return false or assign error markers to prevent the record to be deleted.
Parameters
record: JSRecord - The record that will be deleted
Returns: Boolean - Return false to prevent the record from being deleted.
Example
afterRecordInsert
This event is a record after-insert trigger. This is an ideal mechanism to update the data model after data is known to have been inserted.
Parameters
record: JSRecord - The record that will be inserted
Example
afterRecordUpdate
This event is a record after-update trigger. This is an ideal mechanism to update the data model after data is known to have been updated.
Parameters
record: JSRecord - The record that will be updated
Example
afterRecordDelete
This event is a record after-delete trigger. This is an ideal mechanism to update the data model after data is known to have been deleted.
Parameters
record: JSRecord - The record that will be deleted
Example
onFoundSetRecordCreate
This event is a pre-trigger for a new record being created in the foundset. The event handler has the opportunity to prevent the operation to take place. This is an ideal place to set fail-safe data rules. When false is returned the record will not be created in the foundset.
Returns: Boolean - Return false to prevent the record from being created in the foundset.
Example
onFoundSetFind
This event is a foundset pre-find trigger. The event handler has the opportunity to prevent the operation to take place. This is an ideal place to set fail-safe data rules. When false is returned the foundset will not go into find mode.
Returns: Boolean - Return false to prevent the foundset to enter find mode.
Example
onFoundSetSearch
This event is a foundset pre-search trigger. The event handler has the opportunity to prevent the operation to take place. This is an ideal place to set fail-safe data rules. When false is returned the search will not be executed and the foundset will stay in find mode.
Parameters
clearLastResults: Boolean - tells whether or not to clear previous search
reduceSearch: Boolean - tells to reduce (true) or extend (false) previous search results
Returns: Boolean - Return false to prevent the foundset to enter find mode.
Example
afterFoundSetRecordCreate
This event is a record after-create trigger. It occurs immediately following the operation executed on the foundset.
Parameters
record: JSRecord - The record that is created
Example
afterFoundSetFind
This event is a foundset post-find trigger. When false is returned the foundset will not go into find mode.
Example
afterFoundSetSearch
This event is a foundset post-search trigger. When false is returned the foundset will not go into find mode.
Example
onValidate
Record validation method, will be called by databaseManager.validateRecord() and when databaseManager.saveData() is called. It validates changes or state of the record. All errors need to be reported in the recordMarkers that is then returned by databaseManager.validateRecord() and is also placed on the record itself (record.recordMarkers).
Parameters
record: JSRecord - The record that must be validated
recordMarkers: JSRecordMarkers - The object where all the problems can be reported
stateObject: Object - An object that a user can give to validateRecord for extra state (optional, can be null).
Example
Last updated