Click or drag to resize

DbServer.OrderScope Method (Typed)

X#
Set the boundaries for scoping key values in the controlling order.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VORDDClasses (in XSharp.VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD OrderScope(
	 nScope AS LONG,
	 uValue AS USUAL
) AS USUAL
Request Example View Source

Parameters

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 Tip
If you are using DbServer:OrderDescend() with Scopes, you need to swap the Top and Bottom scope values !
X#
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:
X#
1oDBFr := Friends{}
2oDBFr:SetIndex("age")
X#
1oDBFr:OrderScope(BOTTOMSCOPE, 25)    // Make 25 the lowest age in range
2oDBFr:OrderScope(TOPSCOPE, 30)    // Make 30 the highest age in range
3LIST Age                    // Shows records with 25 <= Age <= 30
4oDBFr:OrderScope(BOTTOMSCOPE, 35)    // Change highest age to 35
5LIST Age                    // Shows records with 25 <= Age <= 35
6oDBFr:OrderScope(TOPSCOPE, NIL)    // Reset top boundary
7LIST Age                    // Shows records with Age <= 35
8oDBFr:OrderScope(BOTTOMSCOPE, NIL)    // Reset bottom boundary
9LIST Age                    // Shows all records
See Also