SchemaField Object
The SchemaField Object is used to hold information about a field for a data table. It's accessible through the fields property on the SchemaDataTable Object.
The code snippet below shows how the fields object can be used:
for (i=0; i<schema.dataTables.count-1; i++)
{
log('schema.dataTables['+i+'].fields.count:'+schema.dataTables[i].fields.count);
for (j=0; j<schema.dataTables[i].fields.count; j++)
{
log('schema.dataTables['+i+'].fields['+j+'].name:'+schema.dataTables[i].fields[j].name);
log('schema.dataTables['+i+'].fields['+j+'].description:'+schema.dataTables[i].fields[j].description);
}
}
Properties
name
Represents the field name - the name of the field the client receives. It does not have to match the real tables field names.
description
Represents an optional description for the field.
dataType
Type of the field, can be one of the following:
Unknown | AutoInc | Blob | Boolean |
Byte | Cardinal | Currency | DateTime |
Decimal | FixedChar | FixedWideChar | Float |
Guid | Integer | LargeAutoInc | LargeInt |
LargeUInt | Memo | SingleFloat | ShortInt |
SmallInt | String | WideMemo | WideString |
Word | Xml |
size
Represents the optional size for the field (for strings).
blobType
Represents the blob type to use for the field (required for oracle). Valid values are:
Unknown | Blob | Memo | OraBlob |
OraClob | Timestamp |
generatorName
Represents the name of the generator for this field. Generators are used in Firebird, PostGreSQL and Interbase for auto incremental primary keys.
calculated
If set, this field is (client side) calculated. Generally, the expression
property is set then, containing how this field will be calculated.
serverCalculated
If set, this field is calculated by the server (either in SQL or code).
defaultValue
Represents the string representation of the default value of this field.
customAttributes
Associated custom attributes, this can contain any string and can be interpreted by accessing this property.
displayFormat
Display format for this field (only used by Data Abstract for Delphi clients).
displayLabel
Display label for this field, this is the name shown to users of the client application.
displayWidth
Display width for this field, in number of characters.
editFormat
Edit format for this field. This is only used from Data Abstract for Delphi and contains the format string for any text field.
editMask
Edit mask for this field. This is only used from Data Abstract for Delphi and contains the edit mask string to use in edit boxes.
inPrimaryKey
If set, this field is part of the primary key.
logChanges
If set, this field is included in the deltas, if not, all changes to this field are ignored.
readOnly
If set, this field cannot be changed.
regExpression
Regular expression for validating the contents of this field.
required
If set, this field cannot be null.
serverAutoRefresh
If set, the server will automatically refresh the value of this field after insert/update, useful when using server logic to modify the data and later sending it back to the client.
visibile
If set, this field is visible, in clients, this bit can be used to determine if it's a field that should be shown to the user of the client application or not.
expression
When using client-side calculated fields this will contain the expression that will evaluate the real value.
alignment
Alignment of this field (Left, Right, Center), used for displaying purposes.