Search code examples
c#filterkendo-gridodata

Is it possible to filter property which inside collection and collection in OData


I have the kendo grid, which using odata filtering. The problem is that I need to filter the property which inside collection and this collection also inside the collection.

Query: CaseStudies/ExamRecords/any(d:contains(d/LevelName,'11'))

CaseStudies - collection

ExamRecords - collection

LevelName - property

I'm not familiar with odata filtering. So the question is how to correct configure request to filter this query?

Because right now I have the following error message: The parent value for a property access of a property 'ExamRecords' is not a single value. Property access can only be applied to a single value.

EDIT 1

I'm using $expand, this issue not about 'How to show collection', this issue about 'How to filter property which inside collection and collection inside collection'.


Solution

  • If you have A contain Bs and B contains Cs, and all these are entities, you filter query should like:

    /.../As?$filter=Bs/any(b: b/Cs/any(c: c/Name eq 'test'))
    

    refer to http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html#_Toc453752358

    5.1.1.10 Lambda Operators