How to Extend Comparison Dimensions in the Comparison Dashboard
In order to add additional Comparison Dimensions into the Comparison Dashboard, follow these steps:
Modify Line Item Logic AGR_FormulaBasedPricing
Introduce new Outputs on Line Item that will be used for the comparison (see How to Add New Outputs to Line Item):
These can be marked as Hidden, utilizing the Hidden_Group Result Group, if you do not want to show them to the user at the Line Item level.
Modify the Dashboard Logic AGR_DashboardScenarioComparison and ConstConfig in AGR_DashboardsLib
Navigate to the AGR_DashboardsLib/ConstConfig element and find the
SCENARIO_COMPARISON_DASHBOARD_CONFIG
field.In the
COMPARISON_MATRIX
key, underCOLUMNS
key, add new Comparison Dimensions (Columns) to display.Use the same structure as the other ones already defined
NAME
defines the displayed name of the columnFORMAT
defines the formatting type of the valueRemember to set the
FORMAT
to an appropriate one for the value returned from LI logic.
Navigate to
AGR_DashboardScenarioComparison
.Find the
resultMatrix
variable that callsapi.newMatrix
, add your new Columns there using the already defined variableresultMatrixColumns
, for example:resultMatrixColumns.MY_NEW_COLUMN.NAME
Do the same with the FORMAT definition below in the return statement of the element. Find
.withColumnFormats
call on thatresultMatrix
variable and add your new columnFORMAT
as a new Map entry, for example:resultMatrixColumns.MY_NEW_COLUMN.NAME : resultMatrixColumns.MY_NEW_COLUMN.FORMAT]
You can additionally add a column aggregation, if the newly added Column is a number. To do so, use
.withColumnAggregation(resultMatrixColumns.MY_NEW_COLUMN.NAME, "SUM")
after the.withGroupBy
call.Now let’s go back to the
getComparisonMatrixRows
method. This method reads the outputs and creates rows for the Comparison Matrix. Navigate inside it and find a return statement.Inside the return statement you have access to the outputs of a line item, they are stored in the same way as, for example, returned from
api.getCalculableLineItemCollection
. To retrieve the value of an output for a given line item, you need to calldecodedOutputs.getAt("Name of the Output Element")?.result
.decodedOutputs
is the variable that should be used to read the output values.After the value has been read, it needs to be assigned to the row structure. This is what the
createLineItemRow
method does. Add your read outputs as new method parameters and use them inside to define the row. Simply add new Map entry with the value, for example:resultMatrixColumns.MY_NEW_COLUMN.NAME : myReadOutputValue
Verify the visibility of the newly added Column(s) on the Dashboard.