Skip to Content

OData v4: $filter on $expand'ed 1:1 cardinality on complex type doesn't work

Hi,

filtering an expanded result set that has inline'd 1:n entities on a complex type, things work as expected:

$expand=toMany($filter=somePropInComplexType eq 'value')

Filtering the same result set on an inline'd 1:1 entity doesn't work:

?$expand=toOne($filter=somePropInComplexType eq 'value')

For demonstration purposes I've built a minimal example over at the "cap community" repo: https://github.com/sapmentors/cap-community/blob/master/structured-types (backup link on fork: https://github.com/vobu/cap-community/tree/feature/structured-types/structured-types)

I've tried both on SQLite and HANA with the same result - 1:n filter works, 1:1 doesn't.

env:

- cds 3.17.4

- sqlite3 4.1.0

- HANA 2.00.037.02.1562323855

Best, Volker

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Oct 14, 2019 at 11:01 AM

    Hi Volker,

    Thanks for raising this issue!
    A filter expression on a to-one relationship is not supported since it is not a collection you're filtering on but either a single entity or no entity at all.

    Do you have a use case for this?

    Thanks a lot and best regards
    David

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.