ODATA:"OR" 运算符的问题
ODATA : Issue with "OR" Operator
我正在尝试使用 OR
运算符创建 ODATA Url。
我有两个 URL 可以正常工作并且有一个如下所示的过滤器
CorporateAccountCollection?$filter=(Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89')
和
CorporateAccountCollection?$filter=(Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89')
我试图将上面的 2 个过滤器与另一个 OR
运算符连接起来,不起作用
/CorporateAccountCollection?$filter=((Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89') or (Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89'))
谁能告诉我我做错了什么?
谢谢
问候
啪啪啪
因为您的条件只是 OR
在一起,所以您不需要使用所有这些括号来强制执行。 (括号应该无关紧要,但取决于 API 使用的查询解析器,双括号有时会被错误地解释为隐式 AND
您的查询应该是:
CorporateAccountCollection?$filter=Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89' or Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89'
或者如果您喜欢外括号:
CorporateAccountCollection?$filter=(Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89' or Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89')
there are no error messages in this scenario because the criteria is simply filtering out the rows that you are expecting to see.
There is no error parsing your query, which is where error messages would normally come from.
如果这不起作用,请提供您的两个有效查询的原始输出,以便我们可以帮助确定其他可能的问题。
usually these issues come down to specific nounces with the strings and values you are comparing.
我正在尝试使用 OR
运算符创建 ODATA Url。
我有两个 URL 可以正常工作并且有一个如下所示的过滤器
CorporateAccountCollection?$filter=(Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89')
和
CorporateAccountCollection?$filter=(Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89')
我试图将上面的 2 个过滤器与另一个 OR
运算符连接起来,不起作用
/CorporateAccountCollection?$filter=((Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89') or (Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89'))
谁能告诉我我做错了什么?
谢谢 问候
啪啪啪
因为您的条件只是 OR
在一起,所以您不需要使用所有这些括号来强制执行。 (括号应该无关紧要,但取决于 API 使用的查询解析器,双括号有时会被错误地解释为隐式 AND
您的查询应该是:
CorporateAccountCollection?$filter=Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89' or Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89'
或者如果您喜欢外括号:
CorporateAccountCollection?$filter=(Phone eq '%2B33 123456789' or Phone eq '%2B33 1 23 45 67 89' or Mobile eq '%2B33 123456789' or Mobile eq '%2B33 1 23 45 67 89')
there are no error messages in this scenario because the criteria is simply filtering out the rows that you are expecting to see.
There is no error parsing your query, which is where error messages would normally come from.
如果这不起作用,请提供您的两个有效查询的原始输出,以便我们可以帮助确定其他可能的问题。
usually these issues come down to specific nounces with the strings and values you are comparing.