javascript 如何使用 $filter 过滤 oData 中的多个字段?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15276617/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 00:09:31  来源:igfitidea点击:

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

javascriptdynamics-crm-2011odata

提问by Bvrce

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

在 JavaScript 中对多个字段/值对应用$filter命令时,过滤多个字段的正确方法是什么?

回答by Konrad Viltersten

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'

回答by Daryl

Put an andin between

and中间放一个

Example:

例子:

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

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