Navigation: ABC Library Reference > FileManager > FileManager Methods >====== GetField (return a reference to a key component) ====== | |
GetField | ( | key, component | ) | |
field tag | ||||
index, field tag, field |
GetField | Returns a reference to the specified key component or field. |
key | The label of the KEY. |
component | A numeric constant, variable, EQUATE, or expression that indicates the component field to reference. A value of one (1) specifies the first component; two (2) specifies the second component, etc. |
field tag | A variable length string that represents the actual field name. |
index | An integer constant, variable, EQUATE or expresssion that contains the field number. |
field | Represents the field name used in a queue structure. |
The GetField method returns a reference to the specified key component or field.
GetField(key, component) | Returns a reference to the specified key component. |
GetField(field tag) | Returns a reference to the field based on the specified field tag. |
GetField(index, field tag, field) | Returns Level:Notify if no field exists at the specified index position. Returns Level:Benign if a field is successfully retrieved at the specified index position. |
Return Data Type:
*?, (untyped variable parameter) where prototype is GetField(key, component)
*?, (untyped variable parameter) where prototype is GetField(field tag)
BYTE where prototype is GetField(index, field tag, field)
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