TDACustomField
From RemObjects Software
This is a Data Abstract Architecture entry
Feel free to add your notes to this topic below.
Overview
TDACustomField expands the abstract TDABaseField to add properties and methods needed for field definitions in data tables, both in the schema and data dictionaries as well as in live TDADataTables.
File
uDAInterfaces
Declaration
TDACustomField = class(TDABaseField);
Hierarchy
- TInterfacedCollectionItem
- TDABaseField
- TDACustomField
- TDABaseField
Properties
| | | |
|---|---|---|
| Alignment | TAlignment | Sets the display alignment used for this field in visual data controls. |
| BusinessClassID | String | |
| Calculated | Boolean | Indicates whether this field is Calculated, or not. Calculated fields do not have direct a physical representation on the database, their value is instead generated on the fly, client side, based on other fields in the same record. For example, a calculated Fullname field could obtain its value by concatenating FirstName and LastName. Calculated fields usually are read-only and do not log changes (since there is no storage space where such changes could be persisted in the database). |
| CustomAttributes | TStrings | Allows the storage of custom, user-defined attributes. This string list will not be evaluated by the Data Abstract library, but it can be used to add custom information to your schema at design time which will later be evaluated by your own client or server-sided code. For example, CustomAttributes could be used to store additional display properties that will be evaluated by the client when displaying data. |
| DefaultValue | String | Defines a default value to be written to the field when adding new records, client-side. |
| DisplayFormat | String | Sets the display format used for this field in visual data controls. Please refer to the Delphi documentation for TField and related classes for details on the syntax for formatting the field values. |
| DisplayLabel | String | Specifies the display label or caption used for this field in visual data controls. By default, this value will be identical to the field's Name. |
| DisplayWidth | Integer | Sets the display width, in pixels, used for this field in visual data controls. |
| EditFormat | String | Defines the editing format used for this field in visual data controls. Please refer to the Delphi documentation for TField and related classes for details on the syntax for formatting the field values. |
| EditMask | String | This is the editing mask for this field in visual data controls. Please refer to the Delphi documentation for TField and related classes for details on the syntax for edit masks. |
| FieldCollection | TDACustomFieldCollection | Returns the collection that this field belongs to. Typically, this will be the Fields property of the TDADataTable (if the field is part of a live data table) or schema TDADataset (if the field is part of a schema definition). |
| InPrimaryKey | Boolean | Indicates whether this field is part of the primary key for the dataset. The primary key (or short PK) consists of the field or fields that uniquely identify each record in a dataset and, eventually, the underlying database table. Please refer to your database system's documentation and general database design guidelines for more information on primary keys. |
| KeyFields | String | Holds the key field or key fields that contain the original value to be looked up on the LookupSource. |
| LogChanges | Boolean | Decides whether changes to this field should be logged as part of the delta so they can layer be applied back to the server. When set to false, the client application will keep no record of changes made to these fields, and any changes made by client application will be lost when the client restarts or refreshes data from the server. |
| Lookup | Boolean | Indicates whether the field is a Lookup Field, whose value will be determined at runtime by looking up values from a different dataset. Similar to calculated fields, lookup fields are not direct representations of a field in the back-end database, but are filled at runtime, usually by using a Foreign Key Relationship to look up values from a secondary table. For example, an Orders table might store a CustomerID field, and additionally have a CustomerName lookup field defined, which will be filled by obtaining the appropriate name (the LookupResultField) from the Customers table (the LookupSource), using the CustomerID (the LookupKeyField). |
| LookupCache | Boolean | Toggles whether values for lookup fields will be cached (true) or reevaluated whenever they are needed. Set this property to true for optimal performance, if data in your lookup source changes rarely; set it to false to make sure your lookup values are always up to date if your data changes frequently. |
| LookupKeyFields | String | Specifies the key field or key fields that will be used on the LookupSource to locate the appropriate record. |
| LookupResultField | String | Sets of the name of the field (in the LookupSource) that contains the result value for the lookup. This field's value will be used as the value for the lookup field itself. |
| LookupSource | TDataSource | Defines the TDataSource that will used as the source to look up field values. |
| OldValue | Variant | Contains the original value of a changed field. If LogChanges is active for a field, the data table will maintain a log of all changes made to the records, until the changes are applied back to the back-end database. After a field's value has changed, this property will give you access to the original value that was obtained from the database. For obvious reasons, OldValue will not be available for newly inserted records. |
| ReadOnly | Boolean | Indicates whether the values contained in this field can be changed (false) or not. |
| RegExpression | String | Sets a Regular Expression that will be used to validate values entered into this field. Any change that does not match the regular expression will be rejected. |
| Required | Boolean | Indicates whether the field requires a non-null value, or not. If set to true, data tables will not accept posting of new records or changes to existing records where this field does not contain a value. Note that the Required property merely enforces client-side data entry; it does not necessarily have to match "required" or "not null" settings on the back-end database (although in most scenarios the two will match). It is entirely possible to set a field as "required" although the back-end database in fact does allow nulls, or vice versa (although in the latter case, applying a null value to the back-end database will of course trigger the appropriate error from the database server). |
| ServerAutoRefresh | Boolean | Allows the value of this field to be automatically refreshed from the server as part of an INSERT or UPDATE. Set this value to true if you expect field values to change on the server when records are inserted or updated (for example due to default values or triggers), and you want your client to automatically receive the new value after the change has been processed. If this value is true, the server will generate a new delta record after processing the change, to allow the values to be sent back to the client and merged into the local client-side data table. This behavior is comparable to AutoInc values, which will also automatically be sent back to the client after inserts. See the AutoIncs and Generators help topic for more details. For AutoIncs, server refresh on insert is implicit, and this property does not need to be set to true. |
| Visible | Boolean | Toggles whether this field should be visible by default in grids and other data-bound controls (true) or not (false). Note that this property only controls the default visibility for "unconfigured" grids and data controls. Individual settings on user controls can override the visibility. |
Events
| | |
|---|---|
| OnChange | Fires whenever the value of a particular field has been changed. |
| OnValidate | Fires whenever the value of a particular field is about to change, given the event handler opportunity to validate and possibly reject the change by raising an exception. |
See Also
Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)
Lists — Glossary — Features — How To — Drivers — Components — Tools — Samples — Articles — Architecture — Issues
Categories: Text | Data Abstract | Architecture | Class | Delphi
