Returns a table showing distinct groups of values found in one or more columns.
SppTableGroupByColumns([Table Array],[Group By Columns])
Where:
Table Array Table Array is a Table Array (such as the data in a standard table, or the result of a QueryDataValues function.
Group By Columns is the indexes of the columns to group by as a pipebar (|) delimited string, for example 2|7|5. Number starting at 1 for the first column.
Rule | Result | Meaning |
---|---|---|
SppTableGroupByColumns(DwLookupPartDetails,"3|4") | {"Quantity","Primary Color"; "3","Red"; "2","Yellow"; "1","Black"; "1","Blue"; "2","Blue"} | Will return an Array showing distinct values from the third and fourth columns. |
See Example Result Viewed as a Table below to see how the result of this example looks when viewed as a table.
The data below exists as a Table in DriveWorks named PartDetails (DwLookupPartDetails)
Part | Price | Quantity | Primary Color | Secondary Color |
---|---|---|---|---|
Casing | 210 | 3 | Red | Red |
Side Panel | 85.4 | 2 | Yellow | Blue |
Railing | 499 | 1 | Black | Orange |
Frame | 387.9 | 1 | Blue | Teal |
Support | 152.5 | 2 | Blue | Blue |
Chassis | 1275.75 | 1 | Black | Black |
The array returned by the rule SppTableGroupByColumns(DwLookupPartDetails,"3|4") will look like:
Quantity | Primary Color |
---|---|
3 | Red |
2 | Yellow |
1 | Black |
1 | Blue |
2 | Blue |