DbServer.OrderKeyCount Method | |
Return the number of keys in an order.
Namespace:
VO
Assembly:
VORDDClasses (in VORDDClasses.dll) Version: 2.19
Syntax VIRTUAL METHOD OrderKeyCount(
uOrder,
oFSIndex
) AS USUAL CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public virtual Usual OrderKeyCount(
Usual uOrder = default,
Usual oFSIndex = default
)
Request Example
View SourceParameters
- uOrder (Optional)
- Type: Usual
The name of the order or a number representing its position in the order list. Using the order name is the preferred method since the position may be difficult to determine using multiple-order index files. If omitted or NIL, the controlling order is assumed.
Specifying an invalid value will raise a runtime error.
- oFSIndex (Optional)
- Type: Usual
A string or filespec object that specifies the name of an index file, including an optional drive and directory (no extension should be specified).
Use this argument with cOrder to remove ambiguity when there are two or more orders with the same name in different index files.
If oFSIndex is not open by the current process, a runtime error is raised.
Return Value
Type:
UsualRemarks
DBServer:OrderKeyCount() counts the keys in the specified order and returns the result as a numeric value. If the order is not conditional and no scope has been set for it, DBServer:OrderKeyCount() is identical to DBServer:RecCount, returning the number of records in the data server. However, for a conditional order, there may be fewer keys than there are records, since some records may not meet the order's for condition or may not fall inside the scope specified by DBServer:OrderScope()—in counting the keys, DBServer:OrderKeyCount() respects the currently defined scope and for condition.
Tip |
---|
If there is no order in operation, DBServer:OrderKeyCount() will return 0 and not the value of DBServer:RecCount().
|
Examples
This example demonstrates using DBServer:OrderKeyCount() with various orders.
1oDBCust := Customer{}
2
3
4
5? oDBCust:RecCount
6? oDBCust:OrderKeyCount()
7oDBCust:CreateIndex("age", "oDBCust:Age")
8oDBCust:SetOrderCondition("oDBCust:Age < 30")
9oDBCust:CreateIndex("first", "oDBCust:FirstName")
10oDBCust:SetOrderCondition("oDBCust:Salary < 50000")
11oDBCust:CreateIndex("last", "oDBCust:LastName")
12
13oDBCust:SetIndex("age")
14oDBCust:SetIndex("first")
15oDBCust:SetIndex("last")
16? oDBCust:RecCount
17? oDBCust:OrderKeyCount()
18? oDBCust:OrderKeyCount("first")
19? oDBCust:OrderKeyCount(3)
See Also