Creates a table showing distinct values in the first column, and summed data in the second.
TableDistinctSum([Table],[Column Index],[Column To Sum])
Where:
Table is the Table from which to get the result.
Column Index is the index of the column to group.
Column To Sum is the column index in the Table Array that will be summed for each unique value in the group column.
Rule | Result | Meaning |
---|---|---|
TableDistinctSum(DwLookupStationaryOrder,1,3) | {"Items","Sum(Quantity)";"2B Pencil",2;"Black Biro",2;"Rubber",1;"HB Pencil",5} | Will return an Array showing distinct values from the first column and summed data from the third column. |
Example StationaryOrder table (used in the example above).
Item | Price | Quantity |
---|---|---|
HB Pencil | 0.60 | 3 |
2B Pencil | 0.60 | 2 |
Black Biro | 0.80 | 1 |
Rubber | 1.50 | 1 |
HB Pencil | 0.60 | 2 |
Black Biro | 0.80 | 1 |
The result given in the example, when viewed as a table, will look like:
Item | Sum(Quantity) |
---|---|
HB Pencil | 5 |
2B Pencil | 2 |
Black Biro | 2 |
Rubber | 1 |