Navigation: ABC Library Reference > FileManager > FileManager Methods >====== KeyToOrder (return ORDER expression for a key) ====== | |
KeyToOrder( key, component )
KeyToOrder | Returns an ORDER attribute expression list (for a VIEW) that mimics the specified key components. |
key | The label of the KEY. |
component | A numeric constant, variable, EQUATE, or expression that indicates the first component field to include in the expression. A value of one (1) specifies the first component; two (2) specifies the second component, etc. |
The KeyToOrder method returns an ORDER attribute expression list (for a VIEW) that mimics the specified key components. The expression list includes the specified component field plus all the subsequent component fields in the key.
See the Language Reference for more information on ORDER.
Implementation:
The component defaults to one (1). The maximum length of the returned expression is 512 characters.
Return Data Type: STRING
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors
Access:Order CLASS(FileManager) !derive Access:Order
END
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
ClientView VIEW(Order) !declare order view
PROJECT(ORD:Cust,ORD:ID,ORD:Date)
END
CODE
!program code
ClientView{PROP:Order}=Access:Order.KeyToOrder(ORD:IDKey,2)!set runtime view order
!ClientView{PROP:Order}='ORD:ID,ORD:Date' !equivalent to this
OPEN(ClientView)
SET(ClientView)