Click or drag to resize

OrderSpec.OrderCreate Method

X#
Create new orders, and if empty, fills in OrderSpec information and associates the created order with the DBFileSpec object.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD OrderCreate(
	oFS,
	cOrder,
	cKeyValue,
	cbKeyValue,
	lUnique
) AS USUAL CLIPPER
Request Example View Source

Parameters

oFS (Optional)
Type: Usual
A string or filespec object that specifies the full path to the target file.
cOrder (Optional)
Type: Usual
The order name. Used for multi-order index files.
cKeyValue (Optional)
Type: Usual
A string of the index key expression.
cbKeyValue (Optional)
Type: Usual
A code block of the index key expression.
lUnique (Optional)
Type: Usual
A logical to determine if this is to be a unique order.

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE.
Examples
The following examples illustrate several different types of orders you can create:
X#
 1// create orders for a multi-order file:
 2oDB := DBFileSpec{, "DBFCDX"}
 3IF oDB:Find()
 4oOrd1 := OrderSpec{oDB}
 5oOrd2 := OrderSpec{oDB}
 6oOrd3 := OrderSpec{oDB}
 7oOrd1:OrderCreate("C:\TEST\customer.cdx", "FirstName", "FirstName")
 8oOrd2:OrderCreate("C:\TEST\customer.cdx", "LastName", "LastName")
 9oOrd3:OrderCreate("C:\TEST\customer.cdx", "CustNum", "CustNum")
10ENDIF
11// create orders for single-order files:
12oDB := DBFileSpec{, "DBFNTX"}
13IF oDB:Find()
14oOrd1 := OrderSpec{oDB}
15oOrd2 := OrderSpec{oDB}
16oOrd3 := OrderSpec{oDB}
17oOrd1:OrderCreate("C:\TEST\cust1.ntx", , "FirstName")
18oOrd2:OrderCreate("C:\TEST\cust2.ntx", , "LastName")
19oOrd3:OrderCreate"C:\TEST\cust3.ntx", , "CustNum")
20ENDIF
21// create some orders using instance variables for a multi-order file:
22oDB := DBFileSpec{, "DBFCDX"}
23IF oDB:Find()
24oOrd1 := OrderSpec{oDB}
25oOrd2 := OrderSpec{oDB}
26oOrd3 := OrderSpec{oDB}
27// create an order starting from record 3 and display the progress.
28oOrd1:FileName := "customer"
29oOrd1:OrderName := "FirstName"
30oOrd1:OrderExpr := "FirstName"
31oOrd1:OrderBlock := {| | _Field->FirstName }
32oOrd1:All := FALSE
33oOrd1:EvalBlock := {| | _Field->FirstName, Qout(RECNO()), TRUE}
34oOrd1:Start := 3
35oOrd1:Rest := TRUE
36// create a unique, descending order on lastname field
37oOrd2:FileName := "customer"
38oOrd2:OrderName := "LastName"
39oOrd2:OrderExpr := "LastName"
40oOrd2:OrderBlock := {| | _Field->LastName }
41oOrd2:Unique := TRUE
42oOrd2:DESCEND := TRUE
43// create a FOR condition based on firstnames with starting letter > "M"
44oOrd3:FileName := "customer"
45oOrd3:OrderName := "FirstName"
46oOrd3:OrderExpr := "FirstName"
47oOrd3:OrderBlock := {| | _Field->FirstName }
48oOrd3:ForCond := "SubStr(_Field->FirstName, 1, 1) > 'M'"
49oOrd3:ForBlock := {| | SUBSTR(_Field->FirstName, 1, 1) > 'M' }
50oOrd1:OrderCreate( )
51oOrd2:OrderCreate( )
52oOrd3:OrderCreate( )
53ENDIF
See Also