Was this helpful?
Table Fields
You can create a table field on your form that contains:
Default columns corresponding to the columns in an existing database table or tables
Default columns that you modify
Columns that you specify from scratch
To create a table field, start with the instructions in Creating a New Table Field, which follows. The remaining topics in this section include information on creating and editing the columns for the table field.
Create a Table Field
To create a new table field on a form
1. In the Form Layout frame, place the cursor where you want the upper left corner of the table field to be, and then choose the Location operation.
The location of the cursor is marked with a plus sign (+).
2. Choose the Create operation.
The Create submenu appears.
3. Choose the TableField operation.
VIFRED displays the Table Field frame.
You can enter the following information on the Table Field form:
Name of Table Field
The internal name of the table field.
Display Lines? (y/n)
Displays or suppresses lines between rows of the table field. The default is to display lines.
Number of Rows to Display
The number of rows to display in the table field. The default is 4.
Highlight Current Row? (y/n)
Displays or suppresses highlighting of current row when cursor is in a table field. The default is no highlighting.
Display Column Titles? (y/n)
Displays or suppresses appearance of column titles. The default is to display column titles.
Invisible Field? (y/n)
Prevents on‑screen display of the entire table field. You cannot place the cursor in this field with the Tab or Return keys.
Title of a Column
The title of the column that the user sees when the form displays.
Column Internal Name
The internal name by which VIFRED identifies the column. By default, the internal name is the same as the column title (with non‑legal characters removed).
Display Format
The display format for the column's data.
In the field, Name of Table Field, type a name that complies with valid object naming rules. For more information, see Naming and Name Use Conventions on page 21.
4. In the field, Number of Rows to Display, type the number of rows that you want displayed in the new table field or press Tab to keep the default value of 4. A table field can display up to 99 rows.
5. In the Display Lines field, choose whether to display lines between the rows of the table field. Type n (no) if you do not want to display lines or press Tab to keep the default value of y. Displaying separation lines leaves less room for data rows.
6. In the Highlight Current Row field, choose whether to highlight the current row the cursor is on whenever the cursor is in the table field. The highlighted row moves with the cursor. This Highlight Current Row function is only available through VIFRED; it cannot be turned on and off dynamically from an application.
7. In the Display Column Titles field, choose whether to display column titles. Choosing n turns off the display of column titles. If you turn off the display of column titles, you can create column titles as trim and use the Box/Line capability to create lines on the form, or you can omit column titles on your form.
8. In the field, Invisible Field, choose whether you want to prevent the on‑screen display of the entire table field. Invisibility applies to the entire table field. You cannot place the cursor on an invisible field with Tab or Return.
9. To create the columns in your table field, you can either use the GetTableDef operation to create default columns, or create your own columns, as follows:
If you are creating a table field that corresponds to one or more tables in the database, you can choose the GetTableDef operation to create default columns based on the database tables, as discussed in Creating Default Table Field Columns with GetTableDef.
When you have created the columns for your Table Field, use the Insert, Delete, EditAttr, and Move operations on the Table Field frame to edit them, as you want. For more information, see the discussions following this procedure.
10. When you finish entering specifications for the new table field:
Select the End operation to return to the Form Layout frame. Your new table field appears.
To cancel the creation of a new table field, choose the Cancel operation instead of the End operation.
11. Use the Save operation to permanently retain the form definition. If you exit without saving the form, all your changes are lost.
Create Default Columns with GetTableDef
If the table field you are creating corresponds to an existing table or tables in the database, you can use the GetTableDef operation to create default columns. VIFRED automatically creates internal names and data display types that match the columns in the corresponding table or tables.
You can then use the default columns as is, or as a starting template, rather than individually entering column titles, display formats, and internal names on the Table Field form.
To use the GetTableDef operation
1. Place the cursor in the table field on the Table Field frame.
2. From the Table Field frame, choose GetTableDef from the menu.
VIFRED prompts you for a table name.
3. Enter the name of the table or tables, including the schema name, if appropriate.
To enter multiple table names, separate the names by a comma; for example, staff, managers, tasks. VIFRED lists all columns from each table in the table field in the order that they appear in the table, and in the order of table names that you specify.
The specifications for the table appear on the Table Field frame.
4. If you want to, edit the specifications with the Insert, Delete, EditAttr, and Move operations on the Table Field frame. For more information, see the discussions following this procedure.
Create Columns
If you do not want to use the GetTableDef operation to create default columns for your table field, as explained in the previous discussion, you can create your own columns by entering an optional title and a mandatory internal name and display format for each column to be included in the table field.
The order in which you list columns in the Table Field frame is the order in which the columns appear across the form's table field from left to right when you are finished creating it. To change the order, see Change the Sequence of Columns.
You must enter values for the Column Internal Name and Display Format columns on the Table Field frame. Titles of columns are optional.
To create your own columns for the table field
1. If you want to enter an optional title, position the cursor at the first blank line in the Title of a Column section of the Table Field frame and type a title for the first column.
2. Use the Tab key to move the cursor to Column Internal Name. If you leave this column blank, VIFRED uses the column title you entered in step 1 as the internal name (excluding non‑legal characters). For more information on the distinction between the internal name and the field title, see Parts of a Form.
3. Press Tab to move the cursor to Display Format.
The display format controls how data is displayed or entered in the field. Specify the column display or input format by typing in the appropriate format code and optional parameters.
4. Press the Menu key when done.
If the field is to correspond to a data column in a table, the display format you specify must be appropriate for the data type and length declared for that column when the table was created. For more information on how display formats and data types are related, see Parts of a Form.
If the field is to be a data entry field, you can specify a data input template as 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 as it is entered, to see if it matches the template. If the user's entry does not match the template format, VIFRED disallows the entry, and the user must 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 (‑).
Edit a Table Field
To edit a table field
1. Position the cursor anywhere in the table field and choose the Edit operation.
VIFRED displays the Table Field frame.
2. Type new information over the existing field contents.
(For specific information on the components of table fields, see the table, Table Field Form Options.)
3. Select the End operation.
You are returned to the Form Layout frame. VIFRED displays the changed table field.
To cancel your changes, choose the Cancel operation. VIFRED returns you to the Form Layout frame without recording your changes. The only exception to this is if you have used the EditAttr operation to make changes in a table field. In this case, because VIFRED has already recorded the attribute changes, you must re‑enter the original values and choose End to return to the Form Layout frame with the equivalent of the original table field displayed.
How You Add Columns
There are two ways to add columns to a table field on the Table Field frame:
Use the GetTableDef operation to append columns from a table; then use the Delete operation to remove any unwanted columns.
Use the Insert operation to insert or append columns.
When you choose the Insert operation on the Table Field frame, VIFRED inserts a new row before the row on which the cursor is currently resting. VIFRED then fills this row with the following default column specifications:
NEW1 for column title, c1 for display format
new1 for column internal name
Type the new title, column internal name, and display format over these default values.
Additional rows added using Insert are given successively numbered titles and internal names. NEW1/new1 are followed by NEW2/new2, NEW3/new3, and so on.
New data columns created with the Insert operation are not linked to and do not affect the data columns in the underlying table.
You can only link new data columns on the VIFRED form to data columns in tables by writing application code in a programming language, or with Vision or Applications‑By‑Forms, that links the field's internal name to the database table column. If you are not familiar with this sort of programming, we recommend that you work with default forms created from JoinDefs or tables, or add columns with the GetTableDef operation. With these methods VIFRED automatically creates the appropriate links between field and data column.
Delete Columns
To delete columns from a table field in the Table Field frame
Position the cursor on the row for the column you want to delete and choose the Delete operation.
VIFRED only removes the deleted column from the form, not from the database table.
Edit Column Titles and Internal Name
To edit column titles and internal names
Position the cursor on the title or internal name in the table field on the Table Field frame. Then type over any current entries you want to change.
Changing a field's internal name affects data transfer to and from the field. We recommend that you change an internal field name only if you are an experienced programmer familiar with the ramifications of such a change.
Change Column Attributes
You can change any column attribute for one column at a time.
To change the attributes of one column
1. In the Table Field frame, position the cursor on the name of the column whose attributes you want to change, and then choose EditAttr.
VIFRED displays the Attributes for Field frame.
2. Change the desired attributes.
Display attributes for a table‑field column apply to the entire column. For example, if you set the Blinking attribute, the entire column blinks.
VIFRED changes the attributes for the column immediately.
3. Choose the End operation.
You are returned to the previous frame.
Once you have used the EditAttr operation, you cannot use the Cancel operation to cancel the changes, because VIFRED has already made them permanent. To change an attribute, choose the Edit operation on the Form Layout frame and repeat this procedure.
Change the Sequence of Columns
You can change the sequence of columns in a table field by using the Move operation on the Table Field frame to change the order in which columns are listed in the form.
To change the sequence of columns in a table field
1. In the Table Field frame, position the cursor on the row containing the specifications for the column you want to move, and then choose Move.
A new menu appears.
2. Position the cursor to where you want to move the column specification.
The column specification currently at that location is pushed down one row when the operation is completed.
3. Choose Place.
VIFRED positions the column specification in the new location.
Last modified date: 01/30/2023