Navigation: ABC Library Reference > FileManager > FileManager Methods >====== GetFieldName (return a key component field name) ====== | |
GetFieldName | ( | key, component | ) | , STRING | |
field number |
GetFieldName | Returns the field name of the specified key component or field number in the record buffer. |
key | The label of the key. |
component | A numeric constant, variable, EQUATE, or expression that indicates the key component number. A value of one (1) specifies the first component; two (2) specifies the second component, etc. |
field number | A variable name that represents the field number in the record buffer. A value of one (1) specifies the first field in the record buffer; two (2) specifies the second field in the record buffer, etc. |
The GetFieldName method returns a field name from the record structure.
GetFieldName(key, component) | Returns the field name based on the specified key and component. This form of the GetFieldName method returns a STRING data type. |
GetFieldName(field number) | Returns the field name based on the specified field number from the record buffer. See WHO. |
Return Data Type: STRING
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors objec
Access:Order CLASS(FileManager) !derive Access:Order object
END
I BYTE
Order FILE,DRIVER('TOPSPEED'),PRE(ORD),THREAD !declare order file
IDKey KEY(Ord:Cust,Ord:ID,Ord:Date),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
Cust LONG
ID LONG
Date LONG
END
END
KeyQueue QUEUE,PRE(KeyQ) !a list of key components
Field ANY !component field reference
FieldName STRING(12) !component field name
END
CODE
!program code
LOOP Access:Order.GetComponents( ORD:IDKey ) TIMES !step thru key components
I += 1 !increment counter
KeyQ.Field = Access:Order.GetField(ORD:IDKey,I) !get component reference
KeyQ.FieldName = Access:Order.GetFieldName(ORD:IDKey,I)!get component name
END