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.QueryRequest
The zApi.QueryResult has the following properties.
Property | Type | Description |
---|---|---|
zoql | String | Indicates the ZOQL query. |
queryOptions | zApi.QueryOptions | Provides information about the queryOptions used in the ZOQL query. |
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. |
zApi.QueryOptions
The zApi.QueryOptions has the following properties. All field names are case-sensitive.
Field | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
batchSize |
Integer |
Defines the batch size of the query result. Range: 1 - 2000 (inclusive). If a value higher than 2000 is submitted, only 2000 results are returned. |
||||||||
caseSensitive |
Boolean: True or False |
Indicates if the query filter results returned consider case-sensitivity. If True, the query results must match the filter and the letter case. If False, the query must match the filter but ignores the letter case. WSDL: Version 14.0+ Example: Suppose you have three active accounts:
Using a SOAP API call, you send the query request: ... select *from Account where name = 'mybigbusiness' ... The query result returns the following when the caseSensitive option is:
|
||||||||
fastQuery |
Boolean: True or False |
If This feature is in Limited Availability. If you want to have access to the feature, submit a request at Zuora Global Support. |
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); }