version 11 (Modified)
SET QUERY LIMIT (limit)
Parameter | Type | Description | |
limit | Number | Number of records, or | |
0 for no limit |
Description
SET QUERY LIMIT allows you to tell 4D to stop any subsequent query for the current process as soon as at least the number of records you pass in limit has been found.
For example, if you pass limit equal to 1, any subsequent query will stop browsing an index or the data file as soon as one record that matches the query conditions has been found.
To restore queries with no limit, call SET QUERY LIMIT again with limit equal to 0.
Warning: SET QUERY LIMIT affects all the subsequent queries made within the current process. REMEMBER to always counterbalance a call to SET QUERY LIMIT(limit) (where limit>0) with a call to SET QUERY LIMIT(0) in order to restore queries with no limit.
SET QUERY LIMIT changes the behavior of the query commands:
QUERY
On the other hand, SET QUERY LIMIT does not affect the other commands that may change the current selection of a table, such as ALL RECORDS, RELATE MANY, and so on.
Examples
1. To perform a query corresponding to the request "...give me any ten customers whose gross sales are greater than $1 M...", you would write:
SET QUERY LIMIT(10) QUERY([Customers];[Customers]Gross sales>1000000) SET QUERY LIMIT(0)
2. See the second example for the command SET QUERY DESTINATION.
See Also
QUERY, QUERY BY EXAMPLE, QUERY BY FORMULA, QUERY BY SQL, QUERY SELECTION, QUERY SELECTION BY FORMULA, QUERY WITH ARRAY, SET QUERY DESTINATION.