Bvrce
Bvrce

Reputation: 2170

How to filter w.r.t. multiple fields in oData using $filter?

What is the correct way to filter w.r.t. multiple fields when applying $filter command on more than one field/value pair from JavaScript?

Upvotes: 7

Views: 13880

Answers (2)

Konrad Viltersten
Konrad Viltersten

Reputation: 39200

It's very canonical.

http://192.168.75.8:5555/Konrad01/
  xrmservices/2011/OrganizationData.svc/
  LeadSet%28%29?$filter=
    Field1%20eq%20%27Value1%27%20and%20Field2%20eq%20%27Value2%27

EDIT:

More readable version.

http://Server:Port/Organization/XrmServices/2011/OrganizationData.svc/
  LeadSet()?$filter=Field1 eq 'Value1' and Field2 eq 'Value2'

Upvotes: 8

Daryl
Daryl

Reputation: 18895

Put an and in between

Example:

http://YourServer.com/YourOrg/xrmservices/2011/OrganizationData.svc/ContactSet()?$filter=FirstName eq 'George' and LastName eq 'Washington'

Upvotes: 4

Related Questions