$apply aggregation on nested collection not working or combined with Param $expand also not functioning
@KenitoInc is already working on this.
Since Feb 8, 2022.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Please check the repository (Sample Project) : https://github.com/padhumailin/ODataV8Demo
Parent entity Accounts has a collection property LinkedAccounts Entity, I need to apply aggregation on collection property
filter on collection is working:
http://localhost:34987/api/accounts?$filter=LinkedAccounts/any(a:a/LinkedAccountName eq 'Loan1')
aggregation on parent entity also working:
http://localhost:34987/api/accounts?$apply=groupby((AccountType), aggregate($count as total))
aggregation on collection property not working
http://localhost:34987/api/accounts?$apply=groupby((LinkedAccounts/ParentId),%20aggregate($count%20as%20OrderCount))
http://localhost:34987/api/accounts?$expand=LinkedAccounts($apply=groupby((ParentId),%20aggregate($count%20as%20OrderCount)))
ERROR:
{"error":{"code":"","message":"The query specified in the URI is not valid. The parent value for a property access of a property 'ParentId' is not a single value. Property access can only be applied to a single value.","details":[],"innererror":{"message":"The parent value for a property access of a property 'ParentId' is not a single value. Property access can only be applied to a single value.","type":"Microsoft.OData.ODataException"
Expected Result:
[{"ParentId":"1","total":3},{"ParentId":"2","total":3},,{"ParentId":"3","total":3}]
Any suggestion on how to implement the EDM model or any diiferent way to write odata parameters to acheive
Environment:
Net 6
OData 8.0.4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.