Home Search

DriveWorks Pro 22
SppTableGroupByColumnsWithMin

Send Feedback

SppTableGroupByColumnsWithMin

Returns a table showing distinct groups of values found in one or more columns. An extra column is appended with the minimum value found in the specified column, in rows, per distinct group.

Syntax

SppTableGroupByColumnsWithMin([Table Array],[Group By Columns],[Min Column])

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.

Min Column is the column in the Table Array that a minimum value for each unique value combination of Group By Columns will be extracted for. Number starting at 1 for the first column.

Example

RuleResultMeaning
SppTableGroupByColumnsWithMin(DwLookupCasingOrders,"1|4",2){"Part","Primary Color","Min(Price)"; "Casing","Red",210; "Frame","Black",250; "Chassis","Blue",230}Will return an Array showing distinct values from the Part (first) column and Primary Color (fourth) column, and append the Min Price (second) column.

See Example Result Viewed as a Table below to see how the result of this example looks when viewed as a table.

Example Data

The data below exists as a Table in DriveWorks named CasingOrders (DwLookupCasingOrders)

PartPriceQuantityPrimary ColorSecondary Color
Casing21015RedRed
Casing20025RedBlue
Frame2505BlackOrange
Chassis19530BlueTeal
Chassis23010BlueBlue
Frame19050BlackBlack

Example Result Viewed as a Table

The array returned by the rule SppTableGroupByColumnsWithMin(DwLookupCasingOrders,"1|4",2) will look like:

PartPrimary ColorMin(Price)
CasingRed200
FrameBlack190
ChassisBlue195