Result Matrices

Sometimes you need to display a table in a Dashboard, Quote, Price List or any other document, for example:

  • Dashboard — As a table in a portlet.

  • Price List — A button will open an overlayed panel with the table.

  • Quote — A button will open an overlayed panel with the table.

In the above examples, the table is calculated in a logic and given as an output to an Element. The type of the object is ResultMatrix.

Configuration

You need to setup:

  • Groovy code in logic’s element, which will return an object of type ResultMatrix.

  • (Optional) Set the Element’s Format Type to Matrix or Charts.

Simple ResultMatrix definition
// Create new ResultMatrix object with 2 columns def resultMatrix = api.newMatrix("Customer Id", "Net Margin %") // Add 3 data rows resultMatrix.addRow([ "Customer Id" : "C1", "Net Margin %" : 0.104 ]) // ❶ resultMatrix.addRow([ "Customer Id" : "C2", "Net Margin %" : 0.044 ]) resultMatrix.addRow([ "Customer Id" : "C3", "Net Margin %" : 0.014 ]) return resultMatrix

Formatting

Column Formatting
matrix.setColumnFormat("Net Margin %", FieldFormatType.PERCENT)
Cell Data Formatting
def value = "C1" def styledValue = matrix.styledCell(value, "#ff0000", "transparent", "bold") resultMatrix.addRow([ "Customer Id" : styledValue, "Net Margin %" : 0.104 ])

Cell Content

Besides text and number, you can also display inside of the Cell the following:

  • Action Buttons

  • URL link

  • Image

Action Buttons

❶ This is a call to REST API, so you’re calling Pricefx using the outside API.Try to always use the Groovy API whenever possible, and such REST API calls only when necessary.

URL Link

Image

How to Get ResultMatrix from DM Query

A result of DM Query can quite easily be turned into a ResultMatrix and thus displayed on screen in Dashboard, Price List, Quote, etc.

Triggering Events

When the ResultMatrix table is displayed in a Dashboard and the user clicks on its row, the click can generate an Event which can cause an Embedded dashboard to be refreshed.

For more information look up the topic Interactive Dashboards.

References

Pricefx Documentation

Groovy API

Knowledge Base

Other functionalities returning ResultMatrix

Found an issue in documentation? Write to us.