SCAN INDEX

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


SCAN INDEX (field; number{; > or <})

ParameterTypeDescription
fieldFieldIndexed field on which to scan index
numberNumberNumber of records to return
> or <> from beginning of index
< from end of index

Description

SCAN INDEX returns a selection of number records for table. 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, but there is no current record.

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

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 
   OUTPUT FORM([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 
   OUTPUT FORM([Customers];"Thanks Letter") 
   PRINT SELECTION([Customers])  ` Print the letters

See Also

ORDER BY, QUERY, REDUCE SELECTION.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next