question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OR-Filter on Property & NavigationProperty

See original GitHub issue

Hi @jjtang1985

Creating a filter query consisting of two filters, one on an entity property and one filter on a NavigationProperty, which are associated with an OR expression, results in an error.

I want to create the following oData filter: $filter=(Id eq <id> or (ExternalIds/any(a0:(a0/ExternalId eq '<id>'))))

This should be done by the following code:

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

But unfortunately the TypeScript compiler returns the following error message:

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

However, linking both filters with an AND expression works fine

.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>'))))

See also the question on the SAP Community.

Used Versions:

  • SAP Cloud SDK: 1.44.0

Regards Simon

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
HeneryHawkcommented, Jul 14, 2021

Hi @jjtang1985,

I tested the fix with the canary version and now everything seems to work. Thanks for your efforts and the quick fix. If something comes up again, I will open a new issue.

Best regards, Simon

2reactions
jjtang1985commented, Jun 7, 2021

Hi @HeneryHawk ,

thanks for sharing the status of your current project.

@artemkovalyov , let’s make a high priority for this.

Best regards, Junjie

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cloud SDK - OR-Filter on Property and NavigationProperty
Hi,. I am working with the SAP Cloud SDK and generate a query with it via requestBuilder. The following code generates the following...
Read more >
Is is possible to filter on an OData navigation property?
Since in my data set, UserGroups is a collection, it will not be possible to perform a filter on this property.
Read more >
Disable $filter for property of navigation property #2388 - GitHub
My goal is to disable $filter for a specific property of a navigation property such that I can do a query like $filter=navProp/any(x:...
Read more >
Optimize Find Navigation Property | Article
Optimize Find Navigation Property. ... The formula can also be used as an order or filter in any navigation.
Read more >
Solved: WEB API - Filtering on nested navigation property
Solved: Hi, Having such of Dataverse table model: EntityA--navigation property x -->EntityX--navigation property y-->EntityY with column.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found