New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregation: Attempting an aggregate or groupby on a referenced collection #463

Open
VikingsFan opened this Issue Feb 14, 2016 · 1 comment

Comments

Projects
None yet
5 participants
@VikingsFan
Contributor

VikingsFan commented Feb 14, 2016

Attempting an aggregate on a referenced collection https://localhost/v5/odata/contacts?$apply=groupby((FirstName,LastName), aggregate(Contributions/Amount with sum as Amount)) throws the exception Microsoft.OData.Core.ODataException: The parent value for a property access of a property 'Amount' is not a single value. Property access can only be applied to a single value.
This matches example 50 under the aggregation extensions (http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs01/odata-data-aggregation-ext-v4.0-cs01.html#_Toc378326330)

copy from OData/WebApi#634

Code: https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Core/UriParser/Binders/EndPathBinder.cs#L136-L145

Need to support bind things like Contributions/Amount.

@VikingsFan VikingsFan changed the title from Aggregation: Attempting an aggregate on a referenced collection to Aggregation: Attempting an aggregate or groupby on a referenced collection Feb 14, 2016

@AlanWong-MS AlanWong-MS added the P3 label Jun 6, 2017

@koniq

This comment has been minimized.

koniq commented Jun 27, 2017

This query throws same type of error :
https://localhost/v5/odata/contacts?$apply=groupby((Contributions/Name), aggregate( $count as freq))
Where "Contributors" is collection of non-primitive type with "Name" property.
According to documentation

In its simplest form the first parameter of groupby specifies the grouping properties, a comma-separated list of one or more single-valued property paths (paths ending in a single-valued primitive, complex, or navigation property) that is enclosed in parentheses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment