A range is based upon a key for the table, and allows you to access a specified portion of the table. The selected range will be treated as an entire table. For instance, a get first statement returns the first record in the range, a get last statement returns the last record in the range, and so on.
The range statement is used to create a range for a table. You can specify one range per table, and the range is associated with a specific key. The range will be used only when the table is accessed by the key the range is associated with.
In the following example, the range statement is used to limit the records accessed to only those for which the Selling Price is between 500 and 1000 dollars. Notice that the same key, composed of the Selling Price field, is used for each of the range statements as well as the get first statement.
{Clear any existing range for the table.} range clear table Inventory_Data; {Set the start of the range.} 'Selling Price' of table Inventory_Data = 500; range start table Inventory_Data by Selling_Price; {Set the end of the range.} 'Selling Price' of table Inventory_Data = 1000; range end table Inventory_Data by Selling_Price; {Read the first record in the range.} get first table Inventory_Data by Selling_Price;
You can use the Table_IsRangeSet() function to find out whether a range is set for a table. |