Field Syntax
The Field Syntax property specifies the input format for data,
including the entry format (for example, 1-Dec-14
or 20141201
),
the allowed characters, and whether the field is mandatory or read-only.
SyntaxCode1{,
SyntaxCodeN} | @LIB::
ModeledFieldSyntax
Value |
Description |
---|---|
|
There are no restrictions placed on the format of data entered in this field. |
SyntaxCode1{ |
Comma-separated string of syntax codes. |
FieldSyntaxLibrary |
Reference to the specified Modeled Field Syntax. |
Field Syntax Codes
When entering codes, the maximum number of
characters allowed is 31. Separate multiple codes with a comma. For example:
UPC,ENT(#&&-###)
.
Code | Description |
---|---|
ENT(Syntax)
|
Entry format for user input. The syntax
code has no effect on values assigned in ProcScript. For more information, see Entry Format. For example, use |
BRM
|
Check that brackets match. |
LEN (n-m) |
Length of field or subfield:
n = minimum, m = maximum The |
REP (n-m) |
Repetition of subfield: n = minimum, m = maximum |
MOD (n)
|
Use check digit modulo number n |
Syntax Codes for Field Control
The following codes determine whether the field is required, visible, editable or can get focus.
Code | Description |
---|---|
DIM
|
Disables the field so that it cannot be edited or get focus. |
HID
|
Hides field. No display, no edit and no
prompt. Not valid in character mode environments. |
JMP
|
Automatically jump to this field. |
MAN
|
Mandatory field (minimum length of one).
This affects both the field syntax (data entry) and the field interface (DBMS). It causes a runtime field syntax check, to ensure that the end user doesn't leave the field empty. It also instructs the DBMS connector that the field is mandatory ("NOT NULL" in SQL terms). |
NDI
|
Do not display the contents of this field.
|
NED
|
Do not allow the field to be edited. |
NPR
|
Do not allow this field to get focus (No
prompt). Note: If you use the |
NIME 1 |
Switch to direct input mode in the Input Method Editor when focus moves to the string field. |
YIME 1 |
Switch to the language-specific input mode in the Input Method Editor when focus moves to the string field. |
1 If YIME and NIME are not specified, the IME is started according to the AUTOIMEOPEN initialization setting. If YIME or NIME is specified, it overrides the AUTOIMEOPEN setting. For more information, see AutoImeOpen. |
Syntax Codes for Allowed Characters
The following codes determine the characters that are allowed in the field. The field's data type determines which codes are valid.
Code |
Description |
---|---|
|
ASCII characters (Unicode range 00-7F). Not valid for Number and Float data types. Default field syntax for Date and Time data types. |
|
Digits only (0-9) |
|
All Unicode characters, depending on value of $FULL_SYNTAX assignment setting. $FULL_SYNTAX Valid only for data types String and Raw. |
|
Extended ASCII characters (Unicode range 00-FF). Not valid for data types Number, Float, Date, and Time. |
|
Numbers only (0-9, Valid only for data types String, Number, Float, Boolean, and Raw. Default field syntax for Number and Float. |
|
Converts alphanumeric characters to lowercase. |
|
Converts alphanumeric characters to uppercase. |
|
Gold characters not allowed |
|
Gold characters allowed |
Syntax Codes for Data Cleanup
The following codes determine whether leading and trailing spaces, zeros, and control codes are kept or deleted.
Code |
Description |
---|---|
|
Deletes leading control characters. |
|
Deletes leading spaces. |
|
Deletes leading zeros. In Forms, the internal value is changed but the displayed value may not be. In a server page, only the displayed value is changed, because there is no internal value. |
|
Deletes trailing control characters. |
|
Keep any control characters. |
|
Keep leading control characters. |
|
Keep text control characters. |
|
Keep leading spaces. |
|
Keep leading zeroes. |
|
Keep trailing control characters. |
|
Replaces contiguous spaces with one space. |
|
Deletes all control characters. |
|
Deletes all text control characters. |
Syntax Codes for Unifields
The following codes are applicable only to Unifields (used in character mode applications).
Code |
Description |
---|---|
|
Bold not allowed. |
|
Carriage return not allowed. Only one-line field allowed. |
|
Italics not allowed. |
|
Underlining not allowed. |
|
Overstrike. |
|
Bold allowed. |
|
Carriage returns allowed. |
|
Italics allowed. |
|
Underlining allowed. |
Description
When users enter text in an edit box or similar widget, their input can be restricted to a range of acceptable values by field syntax settings. Uniface field syntax codes can be used to:
- Control user behavior to some extent (fields can be declared mandatory, or made non-editable).
- Specify that input must conform to a specific character set or allowed characters, such as Unicode, or digits only.
- Pre-process data by ignoring certain parts of the user’s input. For example, Uniface can be instructed to disregard leading or trailing spaces, or convert string data to uppercase.
- Ensure that user input matches a pattern of
characters. For example, a warehouse numbers crates with a digit followed by three uppercase
letters, followed by a hyphen and two digits. This format can be specified in the Field
Syntax property as:
UPC,ENT(#&&-###)
Uniface compares the format of data in the field with the specified pattern. If the data entered does not match the specified pattern, Uniface returns an error and the user is prevented from leaving the field.
You can use syntax strings to check whether information entered in a field is in the required syntax. You can use the same syntax strings for checking syntax in an if ProcScript block.
By defining modeled field syntax objects, you can ensure that the field syntax of similar fields is consistent in all components.