Using the pagesize, startrownum, and recordcountneeded Arguments

The pagesize argument, which has a maximum value of 100, is used to specify the maximum number of records to be returned in a QueryPage response. The pagesize and startrownum arguments are specified as attributes of the ListOf(Object) element in requests, for example:

<ListOfAccount pagesize= "20 ' startrownum= "0 " recordcountneeded= "true ">

Depending on the value of pagesize, records are returned as follows:

  • If the number of records in the record set is less than the pagesize value, the full record set is returned, and the lastpage attribute is set to true.

  • If the number of records in the record set exceeds the pagesize value, only the number of records specified by the pagesize parameter is returned, and the lastpage attribute is false.

  • For a query whose record set exceeds the pagesize value, setting the startrownum attribute to pagesize+1 (setting startrownum to pagesize returns the next pagesize number of records) returns the next pagesize number of records.

  • If the size of the record set is greater than pagesize, and this is a subsequent query where there are less than pagesize number of records remaining to be returned, all of the remaining records are returned and lastpage attribute has a value of true.

Even though the QueryPage method returns a limited number of records, it keeps the data in the cache, which you can then retrieve by calling the QueryPage method again with a new value for the startrownum argument.

If you set the recordcountneeded argument to true, the record count is returned, except when the search specification includes calculated fields:

  • If the QueryPage request contains filter criteria on a calculated field, or a calculated field is part of the value of the searchspec attribute, and there are records that match the given filter criteria, an error is thrown.

  • If the QueryPage request contains filter criteria on a calculated field, or a calculated field is part of the value of the searchspec attribute, and there are no records that match the filter criteria (recordcount = "0" returned), no error is thrown.

Note: There is a performance impact if recordcountneeded is set to true, especially if the search specification contains calculated fields.