SetScope

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

SetScope

Declaration

function SetScope( sLowVal, sHighVal: String ): WordBool;

Description

Sets formal scope. The scope value is matched against the leftmost characters of the CURRENT index expression.

 

Pass all scope values as strings, even if the index is of type date or numeric. Date values must be passed in DTOS form (CCYYMMDD). Data conversion is done internally. Numbers are passed as string representations of the numbers. Logical key values are passed as 'T' or 'F'.

 

QueryRecCount will return the number of records in scope. If QueryRecCount is called when a scope is set, a query bitmap is constructed that is added to any existing query bitmaps. Clearing a scope does not clear a bitmap set with Query, and vice versa.

Parameters

sLowVal: The low scope value. The first record with this key (or the immediately greater if this key does not exist) will become logical top of file.

image\tip.gif To clear a scope, pass sLowVal as a NULL string ('' or #0).

sHighVal: The high scope value. If there is no high value, pass this parameter as a NULL string ('' or #0).

If sHighVal is passed as a NULL string ('' or #0), the scope is evaluated as follows:

IndexKeyField = sLowVal

If sHighVal is passed as a non-NULL string, it must be greater than or equal to sLowVal. If sHighVal exists, the scope is evaluated as:

 

IndexKeyField >= sLowVal .and. IndexKeyField <= sHighVal

 

The last record with a key less than or equal to sHighVal becomes logical bottom of file.

Return Value

True if scope set successfully and False if not.

Delphi Example

// Set scope to view records between Jones and Smith only

ApTbl.SetOrder( ApTbl.TagArea( 'LASTNAME' ));

bRetVal := ApTbl.SetScope( 'Jones', 'Smith' );

C++Builder Example

// Set scope to view records between Jones and Smith only

ApTbl->SetOrder( ApTbl->TagArea( "LASTNAME" ));

bRetVal = ApTbl->SetScope( "Jones", "Smith" );

See Also

GetScope, ScopeBegin, Scoped, ScopeEnd