Page 1 of 1

Xbase++ : DbScope()

Posted: Wed Oct 23, 2019 11:56 pm
by AUGE_OHR
hi,

under Clipper i can use

Code: Select all

#command SET SCOPETOP TO <x>          => OrdScope( TOPSCOPE, <x> )
#command SET SCOPEBOTTOM TO <x>       => OrdScope( BOTTOMSCOPE, <x> )
Question : how can i "test" if i have a active Scope :?:

Code: Select all

   IF DbScope() // active Scope
      // DbScope( [<nScope>] ) --> xScope | aScopeBoth | lIsScope 
      // SCOPE_BOTH, SCOPE_BOTTOM, SCOPE_TOP
   ELSE
      SET SCOPE TO "H" 
   ENDIF
---

i saw DbInfo() and

Code: Select all

#define DBOI_SCOPETOP            39  /* Get or Set the scope top          */
#define DBOI_SCOPEBOTTOM         40  /* Get or Set the scope botto        */
can i use it (and how) to find out if Scope is active :?:

Re: Xbase++ : DbScope()

Posted: Thu Oct 24, 2019 10:26 am
by edk
ordScope()
Set or clear the boundaries for scoping key values in the controlling order

Syntax
ordScope(<nScope>, [<expNewValue>]) → uCurrentValue

Arguments
nScope is a number specifying the top (TOPSCOPE) or bottom (BOTTOMSCOPE) boundary.
Note: To use the TOPSCOPE and BOTTOMSCOPE constants, you must include (#include) the ord.ch header file in your application.
expNewValue is the top or bottom range of key values that will be included in the controlling order's current scope. expNewValue 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 expNewValue 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.

Returns
If expNewValue is not specified, ordScope() returns and clears the current setting. If expNewValue is specified, the function sets it and the previous setting is returned.

Description
The range of values specified using ordScope() is inclusive. In other words, the keys included in the scope will be greater than or equal to 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.

So, try:

Code: Select all

dbOrderInfo( DBOI_SCOPETOP )
dbOrderInfo( DBOI_SCOPEBOTTOM )
For inactive Scope both should return NIL

Re: Xbase++ : DbScope()

Posted: Thu Oct 24, 2019 8:46 pm
by AUGE_OHR
hi,

Code: Select all

lTop  := dbOrderInfo( DBOI_SCOPETOP )
lBott := dbOrderInfo( DBOI_SCOPEBOTTOM )
THX, i will try it