Was this helpful?
Format Templates
A format template is a picture of how you want the data to look when it is displayed or entered in a single‑line field.
For numeric and string data types, a format template consists of character set definitions and special characters. These represent the type and order of the characters that are displayed, or the valid characters that the user can enter in that field. To the system, each character set definition in the template represents one or more characters to be displayed or validated, depending on whether the field is a display‑only or data entry field. To the user, the template provides visual clues about the type and format of the data that must be entered in a data entry field.
For date data types, a format template provides an actual date in a variety of formats. In data entry fields, the user follows the form of the example date in the field to enter the actual date that he or she wants to enter.
Input Masking with Format Templates
In data entry fields, you can optionally use input masking in conjunction with format templates to ensure that the user always enters valid characters in the correct order and position. The format template determines whether a character is valid; what is valid in one template may be invalid in another.
Without input masking, the validity of the user's entry is checked when the user attempts to leave the field. However, if input masking has been turned on for that field and its display format is a format template, the validity of the input is checked as the user enters the data, character by character. The input template is made up of special character codes that indicate what kind of input is allowed for that position in the template. If the user enters an invalid character for that position, the system beeps and requires the user to make a correct entry before continuing. For input templates, data entry mode is overstrike only; insert mode is not allowed. The user can correct entries with the Backspace and Delete keys.
To turn on input masking, you specify a numeric, date, or string template as the display format and set the Input Masking attribute for the field to y (yes) on the VIFRED Attributes for Field frame.
When specifying format templates, you must enter an appropriate template for the data type of the corresponding column in the database table. For example, a numeric template is appropriate for a field corresponding to a column of data type smallint, integer, float, or money, but is not appropriate for a field corresponding to a column of date or character data. For date fields that represent a fixed date value, you must select an absolute date/time template. The following sections tell you how to specify a format template for numeric, date, and string fields, including input masking for data entry fields.
Last modified date: 11/28/2023