4D v16.3

SCAN INDEX

Home

 
4D v16.3
SCAN INDEX

SCAN INDEX 


 

SCAN INDEX ( aField ; number {; > or <} ) 
Parameter Type   Description
aField  Field in Indexed field on which to scan index
number  Longint in Number of records to return
> or <  Operator in > from beginning of index < from end of index

SCAN INDEX returns a selection of number records from the table containing the aField field. If you pass <, SCAN INDEX returns the number of records from the end of the index (high values). If you pass >, SCAN INDEX returns the number of records from the beginning of the index (low values). This command is very efficient because it uses the index to perform the operation.

Note: The selection obtained is not sorted.

SCAN INDEX only works on indexed fields. This command changes the current selection of the table for the current process and loads the first record of the selection as the current record.

If you specify more records than exist in the table, SCAN INDEX will return all the records.

 

Note: This command does not support Object type fields.

Example  

The following example mails letters to 50 of the worst customers and then to 50 of the best customers:

 SCAN INDEX([Customers]TotalDue;50;<) ` Get the 50 worst customers
 ORDER BY([Customers]Zipcode;>) ` Sort by Zip codes
 FORM SET OUTPUT([Customers];"ThreateningMail")
 PRINT SELECTION([Customers]` Print the letters
 SCAN INDEX([Customers]TotalDue;50;>) ` Get the 50 best customers
 ORDER BY([Customers]Zipcode;>) ` Sort by Zip codes
 FORM SET OUTPUT([Customers];"Thanks Letter")
 PRINT SELECTION([Customers]` Print the letters



See also 

ORDER BY
QUERY
REDUCE SELECTION

 
PROPERTIES 

Product: 4D
Theme: Selection
Number: 350

This command changes the currrent recordThe command changes the current selectionThis command can be run in preemptive processes

 
HISTORY 

Created: < 4D v6

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)