PrimaryRangeSearch Command

Use the PrimaryRangeSearch command in a Logic Template search a primary numeric range index for records containing a value that lies within the same sub-range as a user-specified value, or to locate records containing a value that lies within a sub-range that is touched by a user specified range. To obtain exact results, the records returned by a search request should then be filtered by one of the Numeric Filters. Only the PrimaryRangeSearch command should be used to with a primary numeric range index. And, only a primary numeric range index should be searched using the PrimaryRangeSearch command.

The values being compared may be either positive or negative whole numbers. If fractional numbers must be indexed and retrieved, they should be stored as fixed point values with an implied number of decimal places. All values indexed by the numeric range index, as well as the numeric range itself, must have the same number of implied decimal places. Since the index does not currently store the number of implied decimal places, keeping track of the number of implied decimal places is left to the designers and programmers of the indexes and templates. When accessing a numeric range defined using values with implied decimal places, the search request should use values with the same number of implied decimal places.

The results from the search of all primary indexes within a single pass are ORed together, then used to restrict the overall search results from that pass in a highly optimized manner. The restricted results from the current pass are then ORed to the results from all other passes.

To execute a Search Primary Range Index request, use the PrimaryRangeSearch command with three arguments:

PrimaryRangeSearch( idx, val, pas );

PrimaryRangeSearch Arguments

Argument

Description

idx

The primary range index to be searched.

val

The HTML variable containing the lower and upper limits of the numeric range, or the only value being searched for.

pas

The pass during which the search is to be executed.

Access the PrimaryRangeSearch Dialog Box by selecting the Range Index->Primary Index menu item under the Searching category of the Logic Template editor command menu.

Examples

Command

Description

PrimaryRangeSearch( SICindex, SICcode, 2 );

Search the primary numeric range index named "SICindex" for the value stored in the HTML variable "SICcode", during pass 2.

SICcode = 72115;

PrimaryRangeSearch( SICindex, SICcode, 1 );

Search the primary numeric range index named "SICindex" for the value 72115, during pass 1.

IF ( SICcode )

SICscratch = SICcode;

ELSE

SICscratch = 72115;

ENDIF

PrimaryRangeSearch( SICindex, SICscratch, 3 );

Search the primary numeric range index named "SICindex", during pass 3, for the value stored in the HTML variable "SICcode" if it is other than zero, or for the value 72115 if it is zero.

 

PriceRng = [1500 :: 3000];

PrimaryRangeSearch( PriceIndex, PriceRng, 1 );

Search the primary numeric range index named "PriceIndex" for values between $15.00 and $30.00, during pass 1. Original data was stored in fixed decimal format containing both dollars and cents.

IF ( PriceRange )

PrimaryRangeSearch( PriceIndex, PriceRange, 3 );

ENDIF

If the HTML variable "Price" is not empty, search the primary numeric range index named "PriceIndex", during pass 3, for a value within the range stored in the HTML variable "PriceRange".