cancel
Showing results for 
Search instead for 
Did you mean: 

Cloud SDK - OR-Filter on Property and NavigationProperty

former_member194549
Contributor
0 Kudos
39,412

Hi,

I am working with the SAP Cloud SDK and generate a query with it via requestBuilder.
The following code generates the following query

.filter(Entity.ID.equals(id), Entity.EXTERNAL_IDS.filter(any(ExternalIds.EXTERNAL_ID.equals(id))))
$filter=(Id eq <id> and (ExternalIds/any(a0:(a0/ExternalId eq '<id>'))))

This is so far valid, but now I want to combine the two filters with an OR expression.

$filter=(Id eq <id> or (ExternalIds/any(a0:(a0/ExternalId eq '<id>'))))

For this I adjusted my code as follows.

.filter(or(Entity.ID.equals(id), Entity.EXTERNAL_IDS.filter(any(ExternalIds.EXTERNAL_ID.equals(id)))))

But unfortunately I get the following error message.

Argument of type 'OneToManyLink<Assets, ExternalIds>' is not assignable to parameter of type 'Filterable<Assets>'.
  Type 'OneToManyLink<Assets, ExternalIds>' is missing the following properties from type 'Filter<Assets, FieldType | FieldType[]>': field, operator, valuets(2345)

How can I build the query so that the two filters are linked with an OR expression?

Regards
Simon

Junjie
Product and Topic Expert
Product and Topic Expert

Hi sperstorfer ,

thanks for approaching us.

I can reproduce this issue, which is a bug from the SDK side.

May I ask you to create an issue here as the official support board, so other users can check the status of this bug as well?

Thank you very much.

Best regards,

Junjie

former_member194549
Contributor
0 Kudos

Hi dsfas

Thanks for your reply. I have created an issue on GitHub.

Regards
Simon

View Entire Topic
Junjie
Product and Topic Expert
Product and Topic Expert
0 Kudos

As Simon created an issue , I will not update here. Please check the status from the link to our open source repository.