Examples of Using find Operation

Use the various parameters of the find request payload to specify complex search criteria and retrieve attributes from parent and child objects.

Return a Subset of Attributes in the Child Service Data Object

To include the entire LocationProfile child object in the response, add a new findAttribute element containing LocationProfile as the value in the request payload. This example selects the location for which the internal identifier is set to 958. The response returns City, State, Province, Country, LocationId, and all the attributes in the LocationProfile child object.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns1:findLocation 
        xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/
        locationService/applicationModule/types/">
            <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
                <ns2:filter>
                    <ns2:group>
                        <ns2:item>
                            <ns2:attribute>LocationId</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>958</ns2:value>
                        </ns2:item>
                    </ns2:group>
                </ns2:filter>
                <ns2:findAttribute>City</ns2:findAttribute>
                <ns2:findAttribute>State</ns2:findAttribute>
                <ns2:findAttribute>Province</ns2:findAttribute>
                <ns2:findAttribute>Country</ns2:findAttribute>
                <ns2:findAttribute>LocationId</ns2:findAttribute>
                <ns2:findAttribute>LocationProfile</ns2:findAttribute>
            </ns1:findCriteria>
        </ns1:findLocation>
    </soap:Body>
</soap:Envelope>

To include only a subset of the elements from the LocationProfile child object, use the childFindCriteria element and specify the elements to be included using the findAttribute element.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns1:findLocation 
        xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/locationService/
        applicationModule/types/">
            <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
                <ns2:filter>
                    <ns2:group>
                        <ns2:item>
                            <ns2:attribute>LocationId</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>958</ns2:value>
                        </ns2:item>
                    </ns2:group>
                </ns2:filter>
                <ns2:findAttribute>City</ns2:findAttribute>
                <ns2:findAttribute>State</ns2:findAttribute>
                <ns2:findAttribute>Province</ns2:findAttribute>
                <ns2:findAttribute>Country</ns2:findAttribute>
                <ns2:findAttribute>LocationId</ns2:findAttribute>
                <ns2:findAttribute>LocationProfile</ns2:findAttribute>
                <ns2:childFindCriteria>
                    <ns2:findAttribute>LocationProfileId</ns2:findAttribute>
                    <ns2:findAttribute>EffectiveStartDate</ns2:findAttribute>
                    <ns2:findAttribute>EffectiveEndDate</ns2:findAttribute>
                    <ns2:childAttrName>LocationProfile</ns2:childAttrName>
                </ns2:childFindCriteria>
            </ns1:findCriteria>
        </ns1:findLocation>
    </soap:Body>
</soap:Envelope>

The response payload returns only the LocationProfileId, EffectiveStartDate, and EffectiveEndDate of the LocationProfile object, along with the attributes corresponding to the findAttributes element.

<ns0:findLocationResponse xmlns="" 
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns0="http://xmlns.oracle.com/apps/cdm/foundation/parties/locationService/
applicationModule/types/" xmlns:wsa="http://www.w3.org/2005/08/addressing" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <ns2:result xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/" 
    xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/locationService/" 
    xmlns:ns2="http://xmlns.oracle.com/apps/cdm/foundation/parties/locationService/
    applicationModule/types/" 
    xmlns:ns3="http://xmlns.oracle.com/apps/cdm/foundation/parties/partyService/" 
    xmlns:ns4="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/location/" 
    xmlns:tns="http://xmlns.oracle.com/adf/svc/errors/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:type="ns1:LocationResult">
        <ns1:Value>
            <ns1:LocationId>958</ns1:LocationId>
            <ns1:Country>US</ns1:Country>
            <ns1:City>St. Charles</ns1:City>
            <ns1:State>AR</ns1:State>
            <ns1:Province xsi:nil="true"/>
            <ns1:LocationProfile>
                <ns1:LocationProfileId>10035</ns1:LocationProfileId>
                <ns1:EffectiveStartDate>2004-02-23</ns1:EffectiveStartDate>
                <ns1:EffectiveEndDate>4712-12-31</ns1:EffectiveEndDate>
            </ns1:LocationProfile>
        </ns1:Value>
    </ns2:result>
</ns0:findLocationResponse>

Complex Search Criteria at Parent Level

This request payload example searches for locations that have Country set to US and State set to AK in the Location object.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns1:findLocation 
        xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/
        locationService/applicationModule/types/">
            <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
                <ns2:fetchStart>0</ns2:fetchStart>
                <ns2:fetchSize>500</ns2:fetchSize>
                <ns2:filter>
                    <ns2:group>
                        <ns2:item>
                            <ns2:conjunction>And</ns2:conjunction>
                            <ns2:attribute>Country</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>US</ns2:value>
                        </ns2:item>
                        <ns2:item>
                            <ns2:conjunction>And</ns2:conjunction>
                            <ns2:attribute>State</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>AK</ns2:value>
                        </ns2:item>
                    </ns2:group>
                </ns2:filter>
                <ns2:findAttribute>PostalCode</ns2:findAttribute>
                <ns2:findAttribute>City</ns2:findAttribute>
                <ns2:findAttribute>State</ns2:findAttribute>
                <ns2:findAttribute>Province</ns2:findAttribute>
                <ns2:findAttribute>Country</ns2:findAttribute>
                <ns2:findAttribute>LocationId</ns2:findAttribute>
            </ns1:findCriteria>
        </ns1:findLocation>
    </soap:Body>
</soap:Envelope>

The response payload contains PostalCode, City, State, Province, Country, and LocationId of the Location object.

<ns0:findLocationResponse xmlns="" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns0="http://xmlns.oracle.com/apps/cdm/foundation/parties/locationService/applicationModule/types/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <ns2:result xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/" 
    xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/locationService/" 
    xmlns:ns2="http://xmlns.oracle.com/apps/cdm/foundation/parties/locationService/
    applicationModule/types/"
    xmlns:ns3="http://xmlns.oracle.com/apps/cdm/foundation/parties/partyService/"
    xmlns:ns4="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/location/"
    xmlns:tns="http://xmlns.oracle.com/adf/svc/errors/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:LocationResult">
        <ns1:Value>
            <ns1:LocationId>999997516465004</ns1:LocationId>
            <ns1:Country>US</ns1:Country>
            <ns1:City>JUNEAU</ns1:City>
            <ns1:PostalCode>99801-7814</ns1:PostalCode>
            <ns1:State>AK</ns1:State>
            <ns1:Province xsi:nil="true"/>
        </ns1:Value>
        <ns1:Value>
            <ns1:LocationId>999997516000512</ns1:LocationId>
            <ns1:Country>US</ns1:Country>
            <ns1:City>KOTZEBUE</ns1:City>
            <ns1:PostalCode>99752</ns1:PostalCode>
            <ns1:State>AK</ns1:State>
            <ns1:Province xsi:nil="true"/>
        </ns1:Value>
        <ns1:Value>
            <ns1:LocationId>999997518214847</ns1:LocationId>
            <ns1:Country>US</ns1:Country>
            <ns1:City>ANCHORAGE</ns1:City>
            <ns1:PostalCode>99518-1074</ns1:PostalCode>
            <ns1:State>AK</ns1:State>
            <ns1:Province xsi:nil="true"/>
        </ns1:Value>
        ...

Search Criteria with Dependency on Child Data

This example shows how to select parent objects based on search criteria applied to the child objects. The request payload finds all the locations that are in the state of Alaska in the United States, and have an effective date of 1950-04-12 or later in the LocationProfile child object entity. The response payload returns the LocationId and Country attributes in the Location object, and the EffectiveStartDate and LocationId attributes in the LocationProfile child object.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <ns1:findLocation
        xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/
        locationService/applicationModule/types/">
        <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
            <ns2:fetchStart>0</ns2:fetchStart>
            <ns2:fetchSize>500</ns2:fetchSize>
                <ns2:filter>
                    <ns2:group>
                        <ns2:item>
                            <ns2:attribute>Country</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>US</ns2:value>
                        </ns2:item>
                        <ns2:item>
                            <ns2:conjunction>And</ns2:conjunction>
                            <ns2:attribute>State</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>AK</ns2:value>
                        </ns2:item>
                        <ns2:item>
                            <ns2:conjunction>And</ns2:conjunction>
                            <ns2:attribute>LocationProfile</ns2:attribute>
                            <ns2:nested>
                                <ns2:group>
                                    <ns2:item>
                                        <ns2:attribute>EffectiveStartDate</ns2:attribute>
                                        <ns2:operator>ONORAFTER</ns2:operator>
                                        <ns2:value>1950-04-12</ns2:value>
                                    </ns2:item>
                                </ns2:group>
                            </ns2:nested>
                        </ns2:item>
                    </ns2:group>
                </ns2:filter>
                <ns2:findAttribute>LocationId</ns2:findAttribute>
                <ns2:findAttribute>Country</ns2:findAttribute>
                <ns2:findAttribute>State</ns2:findAttribute>
                <ns2:findAttribute>LocationProfile</ns2:findAttribute>
                <ns2:childFindCriteria>
                    <ns2:findAttribute>EffectiveStartDate</ns2:findAttribute>
                    <ns2:findAttribute>LocationProfileId</ns2:findAttribute>
                    <ns2:childAttrName>LocationProfile</ns2:childAttrName>
                </ns2:childFindCriteria>
            </ns1:findCriteria>
        </ns1:findLocation>
    </soap:Body>
</soap:Envelope>

Search Criteria at Child Level

This example shows how to apply search criteria at parent and child levels. The request payload selects the first 500 locations in the state of Alaska in the United States. The response payload returns PostalCode, City, State, Province, Country, and LocationId attributes for the Location object. It also returns Country, FloorNumber, City, State, Province, and EffectiveStartDate attributes for the LocationProfile, if the EffectiveStartDate is equal to or later than 1950-04-12.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns1:findLocation 
        xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/
        locationService/applicationModule/types/">
            <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
                <ns2:fetchStart>0</ns2:fetchStart>
                <ns2:fetchSize>500</ns2:fetchSize>
                <ns2:filter>
                    <ns2:group>
                        <ns2:item>
                            <ns2:attribute>Country</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>US</ns2:value>
                        </ns2:item>
                        <ns2:item>
                            <ns2:conjunction>And</ns2:conjunction>
                            <ns2:attribute>State</ns2:attribute> 
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>AK</ns2:value> 
                        </ns2:item>
                    </ns2:group>
                </ns2:filter>
                <ns2:findAttribute>PostalCode</ns2:findAttribute>
                <ns2:findAttribute>City</ns2:findAttribute>
                <ns2:findAttribute>State</ns2:findAttribute>
                <ns2:findAttribute>Province</ns2:findAttribute>
                <ns2:findAttribute>Country</ns2:findAttribute>
                <ns2:findAttribute>LocationId</ns2:findAttribute>
                <ns2:findAttribute>LocationProfile</ns2:findAttribute>
                <ns2:childFindCriteria>
                    <ns2:filter>
                        <ns2:group>
                            <ns2:item>
                                <ns2:attribute>EffectiveStartDate</ns2:attribute>
                                <ns2:operator>ONORAFTER</ns2:operator>
                                <ns2:value>1950-04-12</ns2:value>
                            </ns2:item>
                        </ns2:group>
                    </ns2:filter>
                    <ns2:findAttribute>Country</ns2:findAttribute>
                    <ns2:findAttribute>FloorNumber</ns2:findAttribute>
                    <ns2:findAttribute>City</ns2:findAttribute>
                    <ns2:findAttribute>State</ns2:findAttribute>
                    <ns2:findAttribute>Province</ns2:findAttribute>
                    <ns2:findAttribute>EffectiveStartDate</ns2:findAttribute>
                    <ns2:childAttrName>LocationProfile</ns2:childAttrName>
                </ns2:childFindCriteria>
            </ns1:findCriteria>
        </ns1:findLocation>
    </soap:Body>
</soap:Envelope>

Sort the Search Results

This example shows how to sort the search results. The request payload finds the Location objects in the state of Alaska in the United States, and sorts them by PostalCode in ascending order and then by City in descending order. The response payload returns PostalCode, City, State, Province, Country, and LocationId attributes in the Location object.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns1:findLocation 
        xmlns:ns1="http://xmlns.oracle.com/apps/cdm/foundation/parties/
        locationService/applicationModule/types/">
            <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
                <ns2:fetchStart>0</ns2:fetchStart>
                <ns2:fetchSize>500</ns2:fetchSize>
                <ns2:filter>
                    <ns2:group>
                        <ns2:item>
                            <ns2:conjunction>And</ns2:conjunction>
                            <ns2:attribute>Country</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>US</ns2:value>
                        </ns2:item>
                        <ns2:item>
                            <ns2:conjunction>And</ns2:conjunction>
                            <ns2:attribute>State</ns2:attribute>
                            <ns2:operator>=</ns2:operator>
                            <ns2:value>AK</ns2:value>
                        </ns2:item>
                    </ns2:group>
                </ns2:filter>
                <ns2:sortOrder>
                    <ns2:sortAttribute>
                        <ns2:name>PostalCode</ns2:name>
                    </ns2:sortAttribute>
                    <ns2:sortAttribute>
                        <ns2:name>City</ns2:name>
                        <ns2:descending>true</ns2:descending>
                    </ns2:sortAttribute>
                </ns2:sortOrder>  
                <ns2:findAttribute>PostalCode</ns2:findAttribute>
                <ns2:findAttribute>City</ns2:findAttribute>
                <ns2:findAttribute>State</ns2:findAttribute>
                <ns2:findAttribute>Province</ns2:findAttribute>
                <ns2:findAttribute>Country</ns2:findAttribute>
                <ns2:findAttribute>LocationId</ns2:findAttribute>
            </ns1:findCriteria>
        </ns1:findLocation>
    </soap:Body>
</soap:Envelope>
Related Topics
  • find Operation
  • Service with Warnings Enabled Examples
  • Request Payload Element Behavior