Was this helpful?
Creation of Simple Fields
If you are working with a default form, VIFRED automatically places a field on the form for every data column in the associated table or JoinDef and creates the appropriate link between the field and its data column.
If you prefer to create your own simple fields, you can do so with the Create Field operation. However, the only way you can link such a user‑created field to a data column in a table is to write application code that links the field's internal name to a data column in the table. If you are not familiar with this type of programming, we recommend that you work with default forms created from JoinDefs or tables, rather than creating your own fields.
Create a New Simple Field
To create a simple field, you must create the following components:
Internal name of the field (see Parts of a Form)
Display or input format of the field
Attributes of the field (or leave them in their default state)
Optional field title
If you create a field title, VIFRED automatically creates a default internal name (see page 13) for the field. If you do not create a field title, you can use the Attributes operation to create an internal field name.
To create a simple field on a form
1. Position the cursor where you want to insert a new field, and then choose Create from the Form Layout frame.
The Create submenu appears.
2. Choose Field.
VIFRED displays another menu with the following operations:
Title
Creates a title for the field (optional).
DisplayFormat
Creates the data window and data display or input format for the field.
Attributes
Sets the attributes of the field.
Cancel
Cancels field creation and returns to the Form Layout frame.
Help, End
Perform standard operations.
3. Choose Title (if you are creating a field title), DisplayFormat, and Attributes in sequence to create the components of the field.
For specific instructions, see the following sections.
4. Select End.
VIFRED displays the field on the form with the specified components.
5. Use the Save operation to permanently keep a form definition. If you exit without saving the form, all your changes are lost.
Create Your Own Internal Field Names
You must not attempt to create your own internal field name unless you are a programmer familiar with the ramifications of doing so. An alternative would be to create a field title with the Title operation and let VIFRED create a default internal field name for you. For more information, see Create Field Titles and Default Internal Names.
To create your own internal field name
1. Choose the Attributes operation on the Create Field submenu of the Form Layout frame.
The Attributes for Field frame appears.
2. Enter the internal name in the Internal Name field.
The name you enter must comply with VIFRED naming conventions. For more information, see Naming and Name Use Conventions.
Create Field Titles and Default Internal Names
When you create a title for a simple field, VIFRED automatically creates an internal name for the field. The field title on the form has no significance other than display. The internal field name is the code name for the field that you use when writing application code in a programming language or with Applications‑By‑Forms or Vision to manipulate the form. For more information on internal field names, see Parts of a Form.
If you do not want to create a field title, you can use the Attributes operation to create only an internal name for a field, as described in Creating Your Own Internal Field Names.
The title and internal name of a field are initially similar (up to the legal limits of internal names), but can be changed separately. This enables you to change the name of the field on a form without changing its underlying internal name or the application code that controls activity in the field. It is common practice in VIFRED to change a form's field titles, but not its internal field names. If you need to do so, you can change the internal name with the Attributes operation as described in Creating Your Own Internal Field Names or in the chapter “VIFRED Field Specifications.”
To create a title and default internal name for a new simple field
1. Choose Create on the Form Layout frame; then choose Field on the Create submenu.
2. Place the cursor where you want the first character of the field's title to appear on the form.
3. Choose the Title operation.
VIFRED displays the message:
Enter title (press <MENU KEY> when done)
4. Enter the title, and then press the Menu key.
You are returned to the previous menu.
Created are a field title, which is displayed on the form, and a field internal name (with non‑legal characters automatically removed) that is not visible on the form.
Create Data Windows and Display Formats
The data window is the part of the field where data is displayed or entered. For a more detailed explanation, see Parts of a Form.
To create a data window when creating a new field
1. Position the cursor at the point on the form in the Form Layout frame where you want the new window to be.
2. Choose the DisplayFormat operation on the Create Field submenu.
VIFRED displays the message:
Enter format (press <MENU KEY> when done)
3. Enter a display or input format.
For example, type in c10 to create a character field that can display a maximum of 10 characters, or type in a format template. For more information, see the discussion following this procedure.
4. Press the Menu key when done.
If the field is to correspond to a data column in a table, make sure that the data window display format you specify is appropriate for the data type and length declared for that column when the table was created.
Note:  You cannot create a field with a display format that can display data from a column of long varchar, byte, byte varying, and long byte data types.
If the field is to be a data entry field, you can specify a data input template for the display format. The data input template indicates to the user how the data must be entered and causes VIFRED to check the input, character by character, to see if it matches the template. If the user's entry does not match the template format, VIFRED disallows the entry, and requires the user to either re‑enter the character in that position or re‑enter the data from the beginning of the field, depending on the particular input template. For more information, see Input Masking in Data Entry Fields.
The following table gives some simple examples of data display and input formats. Keep in mind that some of the display format symbols are the same as data type symbols, yet they perform different functions.
Display
Description
i8
Numeric data, whole numbers only. Up to 8 digits can be entered or displayed.
f10.2
Numeric data with decimal numbers. Field can display 10 characters including the decimal point, with two places shown to the right of the decimal point.
c10
Character data. Field is 10 characters wide.
s'aa\‑zzzzzz'
Data input template for a part number, where a indicates an alphabetic character, z represents a numeric character, and \‑ is a dereferenced hyphen (‑).
Input Masking in Data Entry Fields
VIFRED provides optional input masking for data entry fields. Input masking allows VIFRED to check a user's entry, character by character as it is being entered, against a specified data input format template. If any character does not match the template requirements, VIFRED beeps and does not put that character into the field. The user must type a valid character to continue.
To specify input masking, you need to use one of the following format templates:
Absolute date and time templates
Numeric templates
String templates
You must also ensure that input masking has been turned on for that field. Do this by setting the Input Masking attribute to y (yes) in the Attributes for Field frame. Turning on input masking affects how the field interacts with the user when the application is executing and the kind of data the user can enter. If input masking is off, VIFRED uses the template to check a user's entry only upon exiting the field. Turning on input masking has no effect on fields that do not contain input templates.
How You Create Multi-line Character Fields
You can create character fields that contain more than one line. When you enter data or display it in a multi-line field, it wraps around to the next line each time a line is filled.
To specify a multi-line character field, enter the display format as follows:
The letter c for character data
The total number of characters that can be entered in the field, followed by a period (.)
The maximum number of characters that can be entered on any given line
VIFRED automatically figures the number of lines needed to meet your specification. For example, the display format, c100.20, creates a field of five lines, each of which is 20 characters long.
When creating display‑only fields, you can use the following parameters with the c format to specify different types of justification:
The f parameter wraps text to the next line without breaking the line in the middle of a word (it breaks between words instead). For example, cf100.25 creates a field of four 25-character lines with text wrapped to the next line, with breaks between words.
The j parameter right justifies text. For example, cj100.25 creates a field of four 25-character lines with spaces entered between the words to right justify each line.
When used with either the cf or cj format, the e parameter preserves trailing blanks in multi-line fields; for example, cje100.25 is the same as cj100.25, except that trailing spaces are preserved.
Note:  The f and j parameters are primarily intended for use with display‑only fields. If you use them for data entry fields, VIFRED justifies the text only after the user exits the field. Therefore, spaces between words are lost or added after the user has finished typing the entry and exits the field, which can cause some text to be truncated.
Attributes Operation--Specify Simple Field Attributes
Attributes control the features of a field, such as:
How the field looks on the form
How, and if, data must be entered in the field
Default values
Whether data shown in the field can be changed
Validation checks for new data
Field scrolling
Internal field name
While creating a new simple field, specify field attributes by choosing the Attributes operation on the Create Field submenu of the Form Layout frame. You can also specify attributes for a simple field at a later time by placing the cursor in the field and choosing the Edit operation on the Form Layout frame, followed by the Attributes operation on the Edit submenu. VIFRED then displays the Attributes menu.
For instructions on setting the Name attribute for a new field's internal name, see Create Your Own Internal Field Names. For more information on changing an existing internal field name or specifying other field attributes, see Field Attribute Specifications on page 439.
Edit Simple Fields
To edit a simple field from within the VIFRED Layout frame
Position the cursor on the field you want to edit and choose the Edit operation.
The menu contains the following choices, corresponding to the elements of the field:
Title
Changes the title of the field
DisplayFormat
Changes the data window and data display or input format of the field
Attributes
Sets or changes the attributes of the field
Help, End
Perform standard operations
Edit Field Titles
If you choose Title while editing a simple field, the cursor moves to the first character of the title. Type the new title over the existing text in the window.
By default, you are in overstrike mode so that the characters you type replace the characters at the cursor position. To insert characters without overstriking, press the key defined as the Mode key on your keyboard to change to insert mode.
When in insert mode, move the cursor with an arrow key to where you want to insert characters, and type the insertions. Increasing the width of a component shifts existing components to the right.
Edit the Data Window
Basic data window display formats are indicated on a form by a single letter followed by underscore (_) characters showing the width of the field. The data window of each field on a form begins with the first letter of the display format, as follows:
c = character format
d = date template
f = floating-point format
g = floating-point format
n = floating-point format
i = integer format
e = scientific notation format
The underscore line following these letters represents the number of characters allowed in the field. For example, c_________ denotes a character display type that is 10 characters wide. For long character fields, wraparound lines can be shown by multiple lines of underscoring.
For floating-point numbers, the underscores also indicate how many decimal places to display. For example, f___.__, denotes a floating-point display type with a maximum of four digits to the left of the decimal point and two digits to the right of the decimal point.
For date, numeric, and string input templates, the entire template appears in the field.
To edit the data display format in the data window
1. Place the cursor on the field and choose the Edit operation; then, choose the DisplayFormat operation.
Any single-letter display format identifier changes to the more specific letter-number-parameter display format identifier. For example, if the cursor is on a field shown as c_________, the display format identifier can change to +c10______.
2. Type the new format over the existing format.
For example, to change a display format from 10 alphanumeric characters to 15, type c15 over c10.
3. Press the Menu key when finished.
If you change a field's data display format to a type that is not compatible with the field's data type, VIFRED automatically changes the field's data type to match the display format. This can create problems if you use the field to access data in tables. If you do not also change the data type of the underlying table, a mismatch results between the field data type and the table data type.
Edit the Attributes of a Field
To view or change attributes in one field on an existing form
1. Position the cursor on the field and choose the Edit operation.
A new menu appears.
2. Choose Attributes.
VIFRED displays the Attribute menu.
For more information on attributes, see Field Attribute Specifications.
Last modified date: 04/03/2024