DbServer.OrderScope Method (Typed) | |
Set the boundaries for scoping key values in the controlling order.
Namespace:
XSharp.VO.SDK
Assembly:
XSharp.VORDDClasses (in XSharp.VORDDClasses.dll) Version: 2.21
Syntax VIRTUAL METHOD OrderScope(
nScope AS LONG,
uValue AS USUAL
) AS USUAL
public virtual Usual OrderScope(
[DefaultParameterValueAttribute(0, 0)] int nScope,
[DefaultParameterValueAttribute(0, 1)] Usual uValue
)
Request Example
View SourceParameters
- nScope
- Type: Long
A number specifying the top (TOPSCOPE) or bottom (BOTTOMSCOPE) boundary. - uValue
- Type: Usual
The top or bottom range of key values that will be included in the controlling order's current scope. uValue can be an expression that matches the data type of the key expression in the controlling order or a code block that returns the correct data type.
Omitting uValue or specifying it as NIL has the special effect of resetting the specified scope to its original default. The default top range is the first logical record in the controlling order, and the default bottom range is the last logical record.
Return Value
Type:
Usual
If
uNewValue is not specified, DBServer:OrderScope() returns the current setting. If
uNewValue is specified, the previous setting is returned.
Remarks
The range of values specified using DBServer:OrderScope() is inclusive. In other words, the keys included in the scope will be greater than or equal the top boundary and less than or equal to the bottom boundary.
Tip |
---|
If you are using DbServer:OrderDescend() with Scopes, you need to swap the Top and Bottom scope values !
1oServer:OrderScope (TOPSCOPE, cFrom)
2oServer:OrderScope (BOTTOMSCOPE, cTo)
3oServer:OrderDescend(,, TRUE)
4oServer:OrderScope (TOPSCOPE, cTo)
5oServer:OrderScope (BOTTOMSCOPE, cFrom) |
Examples
This example illustrates using DBServer:OrderScope() to set various scoping limitations on an order. Although not shown in the examples below, the GoTop() or some other pointer mechanism, should be used immediately following the OrderScope() method calls to invoke the scope itself. Checking for :EOF after the GoTop() call will also let you know if
in fact any records even matched the scope conditions:
1oDBFr := Friends{}
2oDBFr:SetIndex("age")
1oDBFr:OrderScope(BOTTOMSCOPE, 25)
2oDBFr:OrderScope(TOPSCOPE, 30)
3LIST Age
4oDBFr:OrderScope(BOTTOMSCOPE, 35)
5LIST Age
6oDBFr:OrderScope(TOPSCOPE, NIL)
7LIST Age
8oDBFr:OrderScope(BOTTOMSCOPE, NIL)
9LIST Age
See Also