How to Limit the Number of Records Retrieved by a Query

Previous Next

See Also

In web pages that perform a database query, the user may provide query conditions that are not restrictive enough, so the query will retrieve too many records. The generation of an XML document, the XSL transformation and the rendering on a browser can take some time. Retrieving hundreds of records may result in unacceptable delays. To prevent this problem, you can limit the number of records to retrieve for each table using the Maximum number of records property of the TableDataSource of the page.

If a query results in more records, you get a warning message. You can use the nextDataSet, previousDataSet, and gotoDataSet actions to display another data set.


The actual number of records that could be retrieved by a query, even if all records are not fetched can be obtained using the totalNbOfRecords attribute in the combined .xml file.

To limit search results:

1. From the catalog, open the page for which you want to limit the search results.
2. In the object tree, double-click the TableDataSource object.
3. In the Property Inspector, set the Maximum number of records property to the required value. The default is 500, and if you set the value to 0, all records are fetched.
4. Save.