OR-Filter on Property & NavigationProperty
See original GitHub issueHi @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:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
Hi @HeneryHawk ,
thanks for sharing the status of your current project.
@artemkovalyov , let’s make a high priority for this.
Best regards, Junjie