My Products
Help
petwob
PARTNER

Query Grouping

by petwob

What's the correct syntax for grouping in a query?
f.e. count and ordersum by countryNo

example query below fails:

query read_orders($cid : Int!)
{
useCompany(no : $cid)
{
order_aggregate(
filter:{
transactionType:{ _eq: 1},
orderDateAsDate:{_gte:"2022-01-01"}
})
{
grouping{countryNo}
count{orderNo}
sum{orderSumNetDomestic}
}
}
}

 

3 REPLIES 3

by Marius Bancila

The grouping aggregate is no longer available in the schema.

by Marius Bancila

This will be removed in the next release of VBNXT.

 

Notice that this aggregate function is not mentioned in the official documentation of GraphQL available here https://docs.business.visma.net/docs/schema/queries/aggregates.

by Marius Bancila (Updated ‎23-06-2022 14:29 by Marius Bancila VISMA )

The grouping aggregate cannot be used like this. It must be used with a column that is part of a group by clause. That is not supported in GraphQL actually. It is a feature supported in VBS for on-premise Visma Business.

 

This was included in the GraphQL schema because the schema is generic and built dynamically from the VB model. It shouldn't be available and we will remove it for the time being.

 

Thank you for reporting this problem to us.