zqueryMore Method
Overview
This article describes the Order Builder zqueryMore() method. The zqueryMore() method uses the Zuora queryMore() method to retreive next results if zquery() did not return the entire result set.
The zqueryMore() method is available in Zuora 360 version 2.60 or higher.
Syntax
zApi.QueryResult zqueryMore (String locator)
Input Parameter
The zqueryMore() method takes the following input parameter.
Parameter | Type | Description |
---|---|---|
locator | String | A marker string, returned by a previous zquery() or zqueryMore() call, that points to the start of the remaining results. Example: "4028e69923eaaa2a0124069b5c887849-50 " |
Response
The zqueryMore() method returns a zApi.QueryResult object that contains the query results in the records field.
A typical workflow might to check the response of zquery()
to see if it's done
, and if not, call zqueryMore()
in a loop until done
is true, indicating that you have retrieved the entire result set.
zApi.QueryResult
The zApi.QueryResult has the following properties.
Property | Type | Description |
---|---|---|
done | Boolean | Indicates whether the query is complete (true) or not (false). You can use this value as a loop condition while iterating through the results of your query. |
queryLocator | String | If done is false, this value can be passed to the zqueryMore() method to retrieve the next series of records. |
records | List | An array of zObjects of the appropriate type (Product, Account, Invoice, etc.), containing the requested data. |
size | Integer | The number of rows retrieved. If size is equal to zero, then no rows were retrieved. |
Exceptions
The zqueryMore() method uses the following exception classes to catch the exception when an error occurs in the call:
zAPIException
zForceException
zRemoteException
Sample Code
zApi api = new zApi(); api.zlogin(); //Set ZOQL for query request zApi.QueryRequest qr = new zApi.QueryRequest(); qr.zoql = 'SELECT Id FROM Account'; //Set query options zApi.QueryOptions qo = new zApi.QueryOptions(); qo.batchSize = 20; qo.caseSensitive = false; qr.queryOptions = qo; // Call zquery() to get initial results zApi.QueryResult queryResult = api.zquery(qr); // If the result set is not complete, call zqueryMore() to get more records zApi.QueryResult queryMoreResult; if(!queryResult.done){ zApi.QueryMoreRequest qmr = new zApi.QueryMoreRequest(); qmr.queryLocator = result.queryLocator; queryMoreResult = api.zqueryMore(qmr); }