Bookshelf Home | Contents | Index | PDF |
Oracle Web Services On Demand Guide > Web Services On Demand API Calls > Web Services v1.0 API Calls > QueryPageExecutes a query against the set of records for an object, and returns the subset of the records that match the search criteria set by the method arguments. Query by TemplateTo improve performance, the QueryPage result contains only those fields and objects that are included in the QueryPage request. To retrieve the values of fields that are not a part of the search criteria, the field must be included in the search request with a blank value. Query by ChildrenFor all Oracle CRM On Demand object methods (except Attachment), it is possible to query using one operation within a parent-child relationship. This type of query is called Query By Children. The query can be assembled using parent attributes as well as child attributes. You can query for all children of a particular parent or set of parents, all parents of a particular child or set of children, or for both parents and children of a particular set. NOTE: When performing a query using Query By Children, certain fields on a child object might not be filterable. Not all child objects are filterable in Web Services v1.0 (for example, the Partner child of Opportunity). CAUTION: This type of query performs slowly and must only be used when necessary. As an example of how you can search for parent records using criteria on a child: <UseChildAnd>true</UseChildAnd> <ContactFirstName>='John'</ContactFirstName> This query would return all contacts where the first name is John and at least one of John's addresses is for Canada. The child criteria are appended to the parent using an AND or OR operator based on the value of the argument UseChildAnd. When UseChildAnd is true, the child criteria are "ANDed", otherwise they are "ORed". Using the PageSize and StartRowNum ArgumentsThe 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 in requests as follows: Depending on the value of PageSize, records are returned as follows:
Even though the QueryPage method returns a limited number of records, the results are cached, and can then be retrieved by calling the QueryPage method with a value of PageSize+1 for the StartRowNum argument. To retrieve all records in the result set, StartRowNum must be incremented by PageSize for each subsequent QueryPage request until a QueryPage response is returned with LastPage equal to true. About Oracle CRM On Demand Query SyntaxThe query syntax supports only a small subset of binary and unary operators. No Siebel Query Language constructs or functions are supported. The query syntax is summarized in Table 23. CAUTION: Queries that are case-insensitive or with leading wildcard characters will perform slowly and must only be used when necessary. In some cases, you can however use shadow fields, see Using Shadow Fields for Better Search Performance. Querying Oracle CRM On Demand Data Using Web ServicesThe QueryPage functions require a list of object instances as input to perform a query. This input argument is called ListOf(Object). For example, the ContactQueryPage method requires the ListOfContact argument. Each ListOf(Object) argument requires at least one instance of the Object to specify a valid query. To query an object by a certain field, specify the expression that corresponds to the desired result. The examples in this topic cover the corner cases of quote and wildcard escaping. Assume that a table in the Oracle CRM On Demand database contains the following values for a particular column that is being queried: ?abc Table 24 specifies the returned record sets for various values of each field value that maps to the preceding list. Querying Multiple FieldsTo specify a query on multiple fields, expressions must be provided for each field comprising the search specification. When multiple fields in an object instance have expressions, the QueryPage method result is the intersection of all the expressions, or in other words, all of the expressions are combined using the AND operator. This is outlined in Example 1: Combining Expressions Using the AND Operator. Example 1: Combining Expressions Using the AND Operator The Web service client requires the first name, last name, and job title of all the contacts in Oracle CRM On Demand that have a job title equal to CEO and a last name equal to Doe. The XML representation of the ListOfContact object that must be sent in the ContactQueryPage call is as follows: <ContactLastName>='Doe'</ContactLastName> Multiple Expressions on a Single FieldIf you want to apply multiple expressions to a single field, you can combine each expression using either the AND or the OR operator. The result is either the intersection or the union of the object instances respectively. NOTE: For multiple expressions on a single field, each expression must be enclosed in brackets. Example 2: Combining Multiple Expressions Using the AND Operator The Web service client requires the first name, last name, and job title of all the contacts that have been updated between July 28, 2009 6:30am and July 28, 2009 6:45 am. Send the following XML representation of the ListOfContact object in the ContactQueryPage call: <LastUpdated> (>='07/28/2009 06:30:00') AND (<='07/28/2009 06:45:00')</LastUpdated > Example 3: Combining Multiple Expressions Using the OR Operator The Web service client requires the first name, last name, and job title of all the contacts in Oracle CRM On Demand that have a last name equal to Doe or Brown. Send the following XML representation of the ListOfContact object in the ContactQueryPage call: <ContactLastName>(='Doe') OR (='Brown')</ContactLastName> Specifying Books in QueriesFor queries on record types that support books, you can use the BookId or BookName arguments to constrain the query to only the records in a particular book. For more information about the use of books, see Oracle CRM On Demand Online Help. ArgumentsTable 25 describes the arguments taken by the QueryPage method. Return Value of the CallAn object or list of objects of the type on which the method was called. |
Oracle Web Services On Demand Guide, Version 21.0 (Oracle CRM On Demand Release 33) | Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |