top

COMPOSITEFILTER

The composite filters can be one of the 2 types:

  ◾ The union - matches any object that is matched by any of the filters it includes.
  ◾ The intersection - matches all objects that are matched by all of the filters it includes.

Add the following line for CompositeFilter class into a html file your own :

  script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js">/script>

You can declare CompositeFilter class like this :

  ex) var filter = new webapis.CompositeFilter("parm1", "parm2");


Constructor

CompositeFilter

Description
CompositeFilter represents a set of filters. The composite filters can be one of the 2 types: ■ The union - matches any object that is matched by any of the filters it includes. ■ The intersection - matches all objects that are matched by all of the filters it includes.
Parameters
type CompositeFilterTypeComposite filter type.
filters AbstractFilterList of filters in the composite filter.
Emulator Support
SDK Constraint
Example
// Define success callback
function successCB(contacts) {
    console.log(contacts.length + " contacts found.");
}

// Define error callback
function errorCB(error) {
    console.log("An error occurred: " + error.message);
}

// Create an attribute filter based on first name: "First name should contain 'Chris' (case insensitive)
var firstNameFilter = new webapis.AttributeFilter("name.firstName", "CONTAINS", "Chris");

// Create an attribute filter based on last name: "Last name should be exactly 'Smith' (case insensitive)
var lastNameFilter = new webapis.AttributeFilter("name.lastName", "EXACTLY", "Smith"};

// Create a filter based on the intersection of these two filter:
// "First name should contain 'Chris' AND last name should be 'Smith'".
var filter = new webapis.CompositeFilter("INTERSECTION", [firstNameFilter, lastNameFilter]);

// Send request on contact address book.
webapis.contact.getDefaultAddressBook().find(successCB, errorCB, filter);