Group questions on the date field by month #1204
Unanswered
kingling-abb
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Try this |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Filter working:odata/dirs/deliverrecords?filter=month(deliveryDate) eq 3
GroupBy :odata/dirs/deliverrecords?$apply=groupby((month(deliveryDate)), aggregate($count as TotalCount))
{
"error": {
"code": "",
"message": "The query specified in the URI is not valid. Expression expected at position 28 in 'groupby((month(deliveryDate)), aggregate($count as TotalCount))'.",
"details": [],
"innererror": {
"message": "Expression expected at position 28 in 'groupby((month(deliveryDate)), aggregate($count as TotalCount))'.",
"type": "Microsoft.OData.ODataException",
"stacktrace": " at Microsoft.OData.UriParser.UriQueryExpressionParser.ParseGroupBy()\r\n at Microsoft.OData.UriParser.UriQueryExpressionParser.ParseApply(String apply)\r\n at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseApplyImplementation(String apply, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)\r\n at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseApply()\r\n at Microsoft.AspNetCore.OData.Query.ApplyQueryOption.get_ApplyClause()\r\n at Microsoft.AspNetCore.OData.Query.Validator.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\r\n at Microsoft.AspNetCore.OData.Query.ODataQueryOptions.Validate(ODataValidationSettings validationSettings)\r\n at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)\r\n at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuting(ActionExecutingContext actionExecutingContext)"
}
}
}
.NET 8.0
Include="Microsoft.AspNetCore.OData" Version="8.2.5"
How should I write this grouping query?
Beta Was this translation helpful? Give feedback.
All reactions