Filter on multiple values


#1

When filtering on multiple values, use Filter.intersects().
For example, use Asset.fetch({filter: Filter.intersects(“id”, [“1”,“2”,“3”])}).


#2

Tim,

what if I want to filter based on multiple fields and for each field I want to filter on multiple values.

E.g. Asset.fetch({filter:‘Filter.intersects(“id”,[“1”,“2”,“3”]) && Filter.intersects(“name”,[“john”,“smith”,“jane”])’})

Is that possible…?


#3

@venkatallagadda You can use the Filter.and property, which is chainable. Example:

Asset.fetch({
 filter: Filter.intersects("id", ["1", "2", "3"]).and.intersects("name", ["john", "smith", "jane"])
});

See the documentation site: https://<environment_url>/static/jsduck/index.html#!/api/C3.util.Filter