Is there a LIKE operator in odata filter?
66,438
Solution 1
Consider contains: $filter=contains(CompanyName,'Alfreds')
Solution 2
$filter=substringof('Alfreds', CompanyName)
for more details see: http://www.odata.org/documentation/odata-version-3-0/url-conventions/ --> 5.1.2.4. Canonical Functions
Solution 3
For me worked $filter=indexof(CompanyName, 'Alfreds') gt -1
. This is case sensitive.
Solution 4
Use
$filter=indexof(CompanyName, 'Alfreds') gt -1
This includes first index and above.
Solution 5
For oData v2, you can try:
$filter=substringof('sites/my folder/subfolder', FileRef) eq true
Samples using public oData Service:
https://services.odata.org/Northwind/Northwind.svc/Customers?$filter=substringof('Futterkiste',CompanyName) eq true
https://services.odata.org/Northwind/Northwind.svc/Customers?$filter=substringof('London',City) eq true
https://services.odata.org/Northwind/Northwind.svc/Customers?$filter=substringof('w',ContactName) eq true and substringof('London',City) eq true
Related videos on Youtube
Author by
Emmanuel Villegas
Updated on October 16, 2020Comments
-
Emmanuel Villegas over 3 years
I'm trying to filter my data through OData where the field FileRef contains lets say
"/The root path/folder/subfolder"
, I tried withsubstringof
like so:$filter=substringof("sites/my folder/subfolder", FileRef)
But it seems doesn´t work, so I wonder if is there an operator like or something that i can use for achieve this.
-
KingRider almost 7 yearsLook a tutorial Odata: docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/…
-
-
mydoghasworms about 4 yearsI think contains is supported only from Odata 3 or 4. It's not available in version 2, AFAIK.