Field Definitions
Fields (or more accurately field definitions) represent a table column definition. They define the specifics of a field, such as the data type, the length and possibly additional validations such as a regular expression. Field definitions can be used to extend a table directly (like adding a new column to the table), but they are also used to create the definitions for code systems and dynamic records. For example, most code definitions consist specify at least two fields; a code field and a description field.
Field | Description |
---|---|
Code |
The unique identifier of the field definition |
Description |
The text that would appear in a LOV on fields |
Data Type |
Number, date or character string |
Decimals |
The number of decimals. Only relevant for data type number. |
Length |
The maximal length of this field. Date fields ignore this attribute. |
Validation |
Optional dynamic logic validation against which the value of this field is validated |
The same field definition can be re-used multiple times. For example, a field definition that captures a date can be used by different tables (and by different names); it remains the same field definition.
The purpose of a validation on a flex field is to impose a restriction on the format (for example the second and third digit must be separated by a decimal point). How to set up a dynamic logic validation is specified in the Implementation Guide for Dynamic Logic. A field can have zero or one validation. To clarify the purpose of these validations, consider the following examples:
-
The numerical value must be between 1 and 24
-
A restriction on the format based on a regular expression
-
A check digit calculation for a bank account number
Consider the following scenario: A payer wants to extend a person with a social security number (SSN). The first step is to create a field that can store a SSN. The payer creates a new field with the following attributes:
-
Code: SSN
-
Description: Social Security Number
-
Data Type: char
-
Length: 11
-
Validation: SSNVAL
SSNVAL is a dynamic logic validation that ensures that the format of a value in this field is 'ddd-dd-dddd' where a 'd' represents a digit between 0 and 9. This validation also ensures that certain combinations cannot be used, such as values that are reserved for commercial use only.