RefTable
See Also: RefClass, RefFunc, RefProc, RefProcSet
Purpose
Allows referencing a table name in an undecorated manner.
Return Type
Syntax
(RefTable({TableName}))
What it Does
This function simplifies working with table numbers and table column numbers by their name. Normally, a Table.Column argument returns the value for that Table.Column argument. RefTable() returns the table number or the column number.
For example:
Move (RefTable(Customer.Name)) to iColumn // would return the column number (2)
If you don't pass the .ColumnName, the table number is returned:
Move (RefTable(Customer)) to iTable // would return the Table number (25)
This means you don't have to use the Get_FieldNumber and Get_FileNumber commands, the .File_Number column literal, or use the FILE and FILE_FIELD modifiers. Those all still work, but this can be easier to use. RefTable() is supported by CodeSense and CodeComplete.
Examples
Example 1
Get_Attribute Field_Length of Customer.File_Number (RefTable(Customer.Name)) to iLength
Get_Attribute Field_Length of (RefTable(Customer)) (RefTable(Customer.Name)) to iLength
Example 2
Function Field_CommitNoEnterOnIndex Integer iField Returns Boolean
Function_Return (RefTable(OrderHea.Order_Date) = iField)
End_Function
Example 3
Procedure ClearNamePrompt
Set Prompt_Object of oCustomerDD (RefTable(Customer.Name)) to 0
End_Procedure
Notes
- RefTable can only be evaluated at compile time.