Was this helpful?
ColumnField Class
The ColumnField class is a stack field that is a column within a table field. Column fields cannot exist independently of table fields.
The ColumnField class provides access to the visual attributes of an individual column in a table field.
In addition to visual characteristics, you can use the ColumnField reference to:
Change the column header (the Title attribute)
Move the column in the table field (the ColumnNumber attribute)
Turn on cell attributes (the HasCellAttributes attribute)
Set some characteristics for all fields in the column (the ProtoField attribute)
The column field must have a name and data type. Normally this will happen automatically if the table field is created from a collection of named active fields or created from a user class. To change the name or datatype of a columnfield, change the name of its ProtoField.
There are three ways to access a column field, depending on whether the code is intended to apply to a specific column in a specific table field, or to any column. For example, to access a column named zipcode in a table field named customer_addresses:
myZipcodeCol = field(customer_addresses[*].zipcode);
More flexibly you could, for example in a procedure to which the names zipcode and customer_addresses had been passed, specify:
myTf = curframe.TopForm.FieldByFullName(fullname=myTfName);
myCol = myTf.TableBody.FieldByName(name=myColName);
To access each column of any table field in turn:
for i = 1 to myTf.TableBody.ChildFields.LastRow do
    myNextCol = myTf.TableBody.ChildFields[i];
endfor;
Changes to properties of the individual fields (cells) in a column field are always applied by OpenROAD through the column CellAttribute (for those properties that can vary from cell to cell in the column, such as BgColor) or the column ProtoField (for those properties that must be identical from cell to cell), regardless of how you access the field in the 4GL.
For information about accessing individual cells in a table field, see CellAttribute Class. For information about the reference syntax for column fields and other parts of a table field, see the Programming Guide.
Access to the data displayed in the individual cells in a table field column cannot be made in the same way; since the table field only displays data, it does not contain it. The data is actually contained by the array object the table field is mapped to, and can only be accessed through the array. The following code would access the value of the surname attribute in the 94th entry of the array displayed by myTableField:
myTableField.GetFieldValue(value=Byref(myTfArray));
myTfArray[94].GetAttribute(surname=Byref(mySurname));
The only exception to this is if the cell is referenced by one of the frame-generic variables like curframe.InputFocusField; if so, the GetFieldValue() method can be used:
curframe.InputFocusField.GetFieldValue(value=Byref(myFieldvalue));
Inherits From
Inherited By
None
Attributes
ColumnNumber
HasCellAttributes
HasSingleCharFind
ParentTable
ProtoField
Title
TitleTrim
Methods
CellAttribute
Last modified date: 12/20/2023