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

"" | Any

There are no restrictions placed on the format of data entered in this field.

SyntaxCode1{,SyntaxCodeN}

Comma-separated string of syntax codes.

FieldSyntaxLibrary::FieldSyntaxName

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(#&&-###).

Field Syntax Codes
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 ENT(DMY) if you want 4-digit year input (for example, 01-01-2014), or ENT(YMD) 2-digits (for example, 14-01-01).

BRM Check that brackets match.
LEN(n-m) Length of field or subfield: n = minimum, m = maximum

The LEN function counts the number of characters in a field. However, when it is used for a numeric field, leading zeros are not counted.

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.

Field Syntax Codes for Field Control
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.

NDI is a static property. It can only be set before the ProcScript edit statement is executed.

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 NED or NPR codes, a user can still give focus to a field, and activate the detail and help triggers. To prevent a user from giving focus to a field, use the DIM syntax.

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.

Syntax Codes for Allowed Characters

Code

Description

ASC

ASCII characters (Unicode range 00-7F).

Not valid for Number and Float data types. Default field syntax for Date and Time data types.

DIG

Digits only (0-9)

FUL

All Unicode characters, depending on value of $FULL_SYNTAX assignment setting. $FULL_SYNTAX

Valid only for data types String and Raw.

MUL

Extended ASCII characters (Unicode range 00-FF).

Not valid for data types Number, Float, Date, and Time.

NUM

Numbers only (0-9, . + -)

Valid only for data types String, Number, Float, Boolean, and Raw. Default field syntax for Number and Float.

LOW

Converts alphanumeric characters to lowercase.

UPC

Converts alphanumeric characters to uppercase.

NGLD

Gold characters not allowed

YGLD

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.

Syntax Codes for Data Cleanup

Code

Description

DLC

Deletes leading control characters.

DLS

Deletes leading spaces.

DLZ

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.

DTC

Deletes trailing control characters.

NDCC

Keep any control characters.

NDLC

Keep leading control characters.

NDCX

Keep text control characters.

NDLS

Keep leading spaces.

NDLZ

Keep leading zeroes.

NDTC

Keep trailing control characters.

RCS

Replaces contiguous spaces with one space.

YDCC

Deletes all control characters.

YDCX

Deletes all text control characters.

Syntax Codes for Unifields

The following codes are applicable only to Unifields (used in character mode applications).

Field Syntax Codes for Formatting Unifields

Code

Description

NBLD

Bold not allowed.

NCR

Carriage return not allowed. Only one-line field allowed.

NITA

Italics not allowed.

NUND

Underlining not allowed.

OVS

Overstrike.

YBLD

Bold allowed.

YCR

Carriage returns allowed.

YITA

Italics allowed.

YUND

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.

Applies To

Related Topics