Click or drag to resize

FieldSpec Class (Typed)

X#
Create a field specification, which holds general data type information about data elements, such as database fields and window controls.
Inheritance Hierarchy
Object
  FieldSpec
    DateFS
    IntegerFS
    LogicFS
    NumberFS
    StringFS

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VOSystemClasses (in XSharp.VOSystemClasses.dll) Version: 2.21
Syntax
[TypesChangedAttribute]
 CLASS FieldSpec
Request Example View Source

The FieldSpec type exposes the following members.

Constructors
  NameDescription
Public methodFieldSpec(String, Usual, DWord, DWord)
Construct a field specification.
Public methodFieldSpec(HyperLabel, Usual, DWord, DWord)
Construct a field specification.
Top
Properties
  NameDescription
Public propertyDecimals
A numeric value representing the number of decimals defined to this field specification.
Public propertyHyperLabel
The hyperlabel connected to this field specification.
Public propertyLength
A numeric value representing the length defined to this field specification.
Public propertyMaximum
A numeric value representing the maximum value in the range validation for this field specification.
Public propertyMinimum
A numeric value representing the minimum value in the range validation for this field specification.
Public propertyMinLength
A numeric value representing the new minimum length validation for this field specification.
Public propertyMinLengthHL
Error message when MinLength validation fails.
Public propertyNullable
Is the field Nullable ?
Public propertyPicture
A string representing the picture clause defined to this field specification. It is used by the FieldSpec:Transform() method.
Public propertyRangeHL
Error message when Range validation fails.
Public propertyRequired
Logical value indicating whether the field is required (TRUE) or not (FALSE).
Public propertyRequiredHL
Error message when Required validation fails.
Public propertyCode exampleStatus
After a validation request (see FieldSpec:PerformValidations() for details), this contains a HyperLabel object that describes the results of the validation or NULL_OBJECT if the validation passed.
Public propertyUsualType
A constant, representing the data type defined to this field specification:
Public propertyValidation
A code block that sets the validation rule for this field specification.
Public propertyValidationHL
Error message when Validation fails.
Public propertyValType
A one-character string representing the data type defined to this field specification:
Top
Functions
  NameDescription
Public method_SetType
Public methodAsString
Return the caption defined to this field specification's hyperlabel; if no caption is defined, return the name defined to the hyperlabel.
Public methodCode examplePerformValidations
Test a specified value to see if it passes all of this field specification's validation rules.
Public methodSetLength
Set a new length for this field specification and new hyperlabel diagnostics for the length check.
Public methodSetMinLength
Set a new minimum length validation for this field specification and new hyperlabel diagnostics for the minimum length check.
Public methodSetRange
Set a new range validation for this field specification and new hyperlabel diagnostics for the range check.
Public methodSetRequired
Set a new required validation for this field specification and new hyperlabel diagnostics for the required check.
Public methodSetType
Set a new data type for this field specification and new hyperlabel diagnostics for the data type check.
Public methodSetValidation
Set a new validation rule for this field specification and new hyperlabel diagnostics for the validation rule check.
Public methodTransform
Convert a specified value into a string, formatted according to this field specification's picture clause.
Public methodVal
Convert a string to a value, according to this field specification's defined data type.
Public methodValidate
A replaceable method for performing validations. The standard implementation evaluates the code block specified through FieldSpec:SetValidation().
Top
Remarks
A FieldSpec object holds a number of properties which relate to fields. Specifically, a FieldSpec object can be defined for: Because both types ultimately apply to fields, a field specification's properties are described in terms of fields only (i.e., not window controls).
Tip Tip
A field specification corresponds to what is sometimes referred to as an "element definition," a "domain," or an "abstract data type."
The field specification holds the following properties:
PropertyDescription
DecimalsThe number of decimals in a field (numeric only)
DiagnosticsHyperlabels for each of the validation rules. Note that a hyperlabel contains not only a diagnostic message, but also a help context to provide for context sensitive help after a validation failure.
HyperLabelInformation about a field: its name, caption, description, and help context
LengthThe length of a field
Min,MaxThe data range allowed in a field
MinLengthThe minimum number of characters allowed in a field (for example, a STATE field can be defined with a Length and MinLength of 2, while a PASSWORD might have a Length of 10 and a MinLength of 4)
PictureA picture clause used to format a field. This is a standard Xbase picture clause, such as @! or 999-99-9999.
StatusA HyperLabel object that describes the results of a validation test (it is NIL if the validation passed)
TypeThe underlying storage type of a field (number, string, logic, date, or memo)
ValidationA code block that sets validation rule to be used for a field (i.e., required fields, data type compliance, range compliance, and so on) Also note that a FieldSpec subclass can be given a Validation() method, which overrides this code block.
See Also