4D v16.3

SET QUERY LIMIT

Home

 
4D v16.3
SET QUERY LIMIT

SET QUERY LIMIT 


 

SET QUERY LIMIT ( limit ) 
Parameter Type   Description
limit  Longint in Number of records, or 0 for no limit

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:

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.

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)

See the second example for the SET QUERY DESTINATION command.



See also 

Get query limit
QUERY
QUERY BY EXAMPLE
QUERY BY FORMULA
QUERY BY SQL
QUERY SELECTION
QUERY SELECTION BY FORMULA
QUERY WITH ARRAY
SET QUERY DESTINATION

 
PROPERTIES 

Product: 4D
Theme: Queries
Number: 395

This command can be run in preemptive processes

 
HISTORY 

Modified: 4D v11 SQL

 
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)