findCollectionEntries()

CustomCollectionEntrySearchResults findCollectionEntries(string collectionCode, SearchCondition criteria, int limit, int offset)

This method searches a custom collection custom fields entries that match a given value. Alternatively this method can be used to retrieve a list of all custom collection entries by specifying an empty SearchCondition.

Parameters

collectionCode
Format: string
Purpose: Specifies the custom collection to be searched.
criteria
Format: SearchCondition XML
Purpose: Defines a SearchCondition XML document that specifies the criterion for the return set. A special case of providing an empty <SearchConditionType> element will result in all entries of the given collection returned.
limit
Format: integer
Purpose: Specifies the maximum number of results to return. May not exceed 200.
offset
Format: integer
Purpose: Specifies the offset into the result set of where to begin returning results.

Note that the limit and offset parameters work in a similar way to SQL's LIMIT and OFFSET clauses. The result set order is guaranteed to be stable and non-repeating so that multiple consecutive calls to findCollectionEntries() can be made with offset=offset+limit to scroll through the result set.

Example: A request SearchCondition XML document

This example shows a SearchCondition XML document.

<SearchCondition xmlns="http://ws.inomial.com/smile.2">
  <Equals>
    <Attribute>colour</Attribute>
    <Value>Purple</Value>
  <Equals>
</SearchCondition>

Results

This method returns a CustomCollectionEntrySearchResults XML document containing a list of entries in the given collection that match the criteria. An empty <CustomCollectionEntryList> element inside the <CustomCollectionEntrySearchResults> element will be returned if there are zero matches.

If there are more results in the result set than the limit argument, then the moreResults attribute will be set to true. If you are at the end of the results set, then moreResults will be set to false.

There are no messages defined by this method.

Example: A returned CustomCollectionEntrySearchResults XML document

This example shows a CustomCollectionEntrySearchResults XML document.

<CustomCollectionEntrySearchResults xmlns="http://ws.inomial.com/smile.2" limit="200" offset="0" moreResults="false">
  <CustomCollectionEntryList>
    <CustomCollectionEntry key="6326">
      <CollectionCode>productList</CollectionCode>
      <EntryCode>modem</EntryCode>
      <Object objectId="6326" formId="870" displayName="adslsmodem - ADSL modem (Purple)">
        <String name="productDescription">ADSL modem</String>
        <String name="productCode">adslmodem</String>
        <String name="colour">Purple</String>
      </Object>
    </CustomCollectionEntry>
    <CustomCollectionEntry key="6541">
      <CollectionCode>productList</CollectionCode>
      <EntryCode>3gwifimodem</EntryCode>
      <Object objectId="6541" formId="870 displayName="3gwifi - 3G Wireless Modem (Purple)"">
        <String name="productDescription">3G Wireless Modem</String>
        <String name="productCode">3gwifi</String>
        <String name="colour">Purple</String>
      </Object>
    </CustomCollectionEntry>
  </CustomCollectionEntryList>
</CustomCollectionEntrySearchResults>

Faults

NoSuchItemException
This fault is returned when:
  • a collection code refers to a non-existent custom collection
  • the <Attribute> element refers to a non-existent custom field

Java client syntax

java -cp build/smilewsv2-client.jar [options]
 com.inomial.smile.client.v2.examples.FindCollectionEntries
 collectionCode filename limit offset
collectionCode
Purpose: Specifies the custom collection to be searched.
filename
Purpose: Specifies the filename of the SearchCondition XML document that contains the content for the criteria argument.
limit
Purpose: Specifies the maximum number of results to return. moreResults="true" will be returned in result if more results exist beyond this limit. Must be a positive integer not exceeding 200.
offset
Purpose: Specifies the offset into the result set of where to begin returning results. Must be a non-negative integer.
Note: For more information about the Java client and the options it accepts, see Java client syntax.