Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a LIKE operator in odata filter?

Tags:

rest

odata

I'm trying to filter my data through OData where the field FileRef contains lets say "/The root path/folder/subfolder", I tried with substringof 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.

like image 554
Emmanuel Villegas Avatar asked Apr 17 '17 03:04

Emmanuel Villegas


People also ask

How does OData filter work?

The $filter system query option allows clients to filter a collection of resources that are addressed by a request URL. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response.

What are the operations used in OData?

The OData service interface has a fixed number of operations that have uniform meaning across all the resources it can act on. These operations are retrieve, create, update and delete and they map to the GET, POST, PUT/MERGE and DELETE HTTP methods.

What is Uri in OData?

Introduction. The Open Data Protocol (OData) enables the creation of REST-based data services, which allow resources, identified using Uniform Resource Identifiers (URIs) and defined in a data model, to be published and edited by Web clients using simple HTTP messages.

Is OData filter case sensitive?

OData API filter value which you are selecting for $FILTER parameter is always case sensitive.


Video Answer


3 Answers

Consider contains: $filter=contains(CompanyName,'Alfreds')

like image 147
John Little Avatar answered Nov 02 '22 05:11

John Little


$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

like image 45
David Lopes Avatar answered Nov 02 '22 05:11

David Lopes


For me worked $filter=indexof(CompanyName, 'Alfreds') gt -1. This is case sensitive.

like image 42
scher Avatar answered Nov 02 '22 06:11

scher