Reputation: 16980
In a discussion with my colleague a question came up as to whether you have to add eq true
after a call to substringof
method in the OData URL filter:
http://localhost/Collection/WorkItems()?$filter=substringof('crash',Title)
http://localhost/Collection/WorkItems()?$filter=substringof('crash',Title) eq true
Now I'm consulting with the ABNF for OData revised on 4/27/2012. Looking at the filter
expression form, it wants a boolCommonExpr
:
filter = "$filter" [ WSP ] "=" [ WSP] boolCommonExpr
A boolCommonExpr
lists boolMethodCallExpr
as one of its alternatives. But there is no definition for the boolMethodCallExpr
symbol in the ABNF!
So, I'm guessing it is a bug in the ABNF and the correct alternative listed there must be boolMethodExpr
, not boolMethodCallExpr
:
boolMethodExpr = endsWithMethodCallExpr /
startsWithMethodCallExpr /
substringOfMethodCallExpr /
intersectsMethodCallExpr /
anyMethodCallExpr /
allMethodCallExpr
In this case a call to substringof
method is allowed to go without eq true
in the URI (as well as with eq true
).
Is my understanding correct?
Upvotes: 0
Views: 201
Reputation: 174
You should not need to have " eq true" on the end of the URL. Any of the built-in functions that return Boolean should be good enough on their own. This looks like it was probably just a typo in the ABNF (especially given boolMethodCallExpr isn't defined). That particular document isn't even complete, and has several TODOs in it. A more definitive ABNF should be forthcoming as OASIS standardization of OData comes together.
Upvotes: 1