19. Using 4GL : Referencing Fields, Variables, and Constants : Referencing Table Fields, Columns, and Hidden Columns
 
Share this page                  
Referencing Table Fields, Columns, and Hidden Columns
The procedure for referencing a table field, table field column, or hidden column in 4GL is similar to the procedure for referencing a form containing simple fields. If you do not name the row number explicitly, 4GL assumes you mean the column in the current row—the row on which the cursor is currently located.
If the cursor is not currently on the table field, the current row is undefined, except in an unloadtable loop. Data retrieval at run time is unsuccessful.
The syntax for referencing a table-field column or hidden column in the current row is:
tablefieldname.columnname
The colon, if used, must precede the full designation of the column, as in the following example:
callframe :tablefieldname.name;
Follow the rules for simple fields stated earlier in this section to determine when to include the colon with a column name. The only difference is that the colon is required when a table field column appears on the left-hand side of an assignment within the target list of a select into a form or a select into simple objects.
Statements referring to a column always refer to the column's internal name, as defined using the ABF FormEdit operation. This name is distinct from the title above the column on the form.
To reference the column name in the table field children for the current row, use:
children.name
The following statement assigns the value "Grey" to the name column of the current row:
children.name := 'Grey';
How You Reference an Element of a Table Field
To reference individual elements of a table field, you can specify or index a row by number and a column by name. The syntax for referring to a column is:
tablefieldname [integerexp].columnname
Integerexpr is an expression that evaluates into an integer, and is not nullable. It is the number of a row the table field displayed in the window, not the record number in the underlying data set.
For example, the following statement assigns the value "Sally" to the name column in the third row of the children table field:
children[3].name := 'Sally';
Because the row number is specified, this statement is valid whether or not the cursor is on the table field.