New to KendoReactStart a free 30-day trial

aggregateBy

Function

Definition

Package:@progress/kendo-data-query

Syntax:

ts
const data = [
   { unitPrice: 23, unitsInStock: 21 },
   { unitPrice: 10, unitsInStock: 12 },
   { unitPrice: 20, unitsInStock: 33 }
];

const result = aggregateBy(data, [
  { aggregate: "sum", field: "unitPrice" },
  { aggregate: "sum", field: "unitsInStock" }
]);

//output:
// {
//     "unitPrice": { "sum": 53 },
//     "unitsInStock": { "sum": 66 }
// }

Applies the specified AggregateDescriptors to the data. Returns an AggregateResult instance.

Parameters:dataT[]

The data on which the calculation will be executed.

descriptorsAggregateDescriptor[]

The aggregate operations that will be executed.

transformers(reduce: Combinator) => Transformer

For internal use.

Returns:

AggregateResult

  • The aggregated result.
In this article
Definition
Not finding the help you need?
Contact Support