Click or drag to resize

OrdScope Function

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

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION OrdScope(
	kScope,
	uNewValue
) AS USUAL CLIPPER
Request Example View Source

Parameters

kScope (Optional)
Type: Usual
A number specifying the top (TOPSCOPE) or bottom (BOTTOMSCOPE) boundary.
uNewValue (Optional)
Type: Usual
The top or bottom range of key values that will be included in the controlling order's current scope. uNewValue 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 uNewValue 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, OrdScope() returns and clears the current setting.
If uNewValue is specified, the function sets it and the previous setting is returned.
Remarks
The range of values specified using OrdScope() 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. Note:
To return current settings without changing them, call the DBOrderInfo() function, using the DBOI_SCOPETOP and DBOI_SCOPEBOTTOM constants. By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression
Examples
This example illustrates using OrdScope() to set various scoping limitations on an order:
X#
 1USE friends
 2SET INDEX TO age
 3// Make 25 the lowest age in range
 4OrdScope(TOPSCOPE, 25)
 5// Make 30 the highest age in range
 6OrdScope(BOTTOMSCOPE, 30)
 7LIST Age                // Shows records with 25
 8                    // <= Age <= 30
 9// Change highest age to 35
10OrdScope(BOTTOMSCOPE, 35)
11LIST Age                // Shows records with 25
12                    // <= Age <= 35
13// Reset top boundary
14OrdScope(TOPSCOPE, NIL)
15LIST Age                // Shows records with Age <= 35
16// Reset bottom boundary
17OrdScope(BOTTOMSCOPE, NIL)
18LIST Age                // Shows all records
See Also