| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > FileManager > FileManager Methods >====== KeyToOrder (return ORDER expression for a key) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[insert add a new record .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[kill shutdown the filemanager object .htm|{{btn_next_n.gif|Next page}}]] | | || **KeyToOrder( **//key, component //**)** {{blk2blue.jpg|blk2blue.jpg}} | **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 set view sort order expression .htm|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)**