...
Code Block | ||
---|---|---|
| ||
import net.pricefx.common.api.FieldFormatType def productList = null List<String> fields = ["ProductId", "label", "ProductGroup", "currency", "BusinessUnit", "ProductClass", "Size", "ProductLifeCycle" ] productList = api.find("P", 0, api.getMaxFindResultsLimit(), "ProductId", fields) def columnFormats = [ "ProductId": FieldFormatType.TEXT, "label": FieldFormatType.TEXT, "ProductGroup": FieldFormatType.TEXT, "currency": FieldFormatType.MONEY_EUR, "BusinessUnit": FieldFormatType.TEXT, "ProductClass": FieldFormatType.TEXT, "Size": FieldFormatType.TEXT, "ProductLifeCycle": FieldFormatType.TEXT, ] def rows = productList def resultMatrix = api.newMatrix() .withColumnFormats(columnFormats) .withRows(rows) .withGroupBy(['BusinessUnit']) .withGroupBy(['ProductGroup']) .withGroupBy(['Size']) return resultMatrix |
Result
...
Aggregation Example
In the following example we retrieve the data from the Product Extensions table. We apply group by Currency column and then aggregate SUM on ListPrice column.
...