Home Search

DriveWorks Pro 22
SppSumTableColumnByGroup

Send Feedback

SppSumTableColumnByGroup

Returns a two column table showing distinct values in the first column, and summed data in the second.

Syntax

SppSumTableColumnByGroup([Table Array],[Group By Column],[Column To Sum],[Sort results on summed column])

Where:

Table Array is a Table Array (such as the data in a standard table, or the result of a QueryDataValues function.

Group By Column is the column in the Table Array that will be grouped.

Column To Sum is the column in the Table Array that will be summed for each unique value in the Group By Column.

Sort results on summed column (optional) is TRUE to sort the results by their respective sums in ascending order. Leaving blank or using FALSE will return the result in the order found in the initial array.

Example

RuleResultMeaning
SppSumTableColumnByGroup(DwLookupStationaryOrder,1,3, TRUE){"Items","Sum(Quantity)";"Rubber",1;"2B Pencil",2;"Black Biro",2;"HB Pencil",5}Will return an Array showing distinct values from the first column and summed data from the third column.

Example Data

This table shows an example order and where some items may of been added to an order more than once and there quantities need adding together.

ItemPriceQuantity
HB Pencil0.603
2B Pencil0.602
Black Biro0.801
Rubber1.501
HB Pencil0.602
Black Biro0.801