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

  1. Introduce new Outputs on Line Item that will be used for the comparison (see How to Add New Outputs to Line Item):

    1. 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

  1. Navigate to the AGR_DashboardsLib/ConstConfig element and find the SCENARIO_COMPARISON_DASHBOARD_CONFIG field.

  2. In the COMPARISON_MATRIX key, under COLUMNS key, add new Comparison Dimensions (Columns) to display.

    1. Use the same structure as the other ones already defined

      1. NAME defines the displayed name of the column

      2. FORMAT defines the formatting type of the value

        1. Remember to set the FORMAT to an appropriate one for the value returned from LI logic.

  3. Navigate to AGR_DashboardScenarioComparison.

  4. Find the resultMatrix variable that calls api.newMatrix, add your new Columns there using the already defined variable resultMatrixColumns, for example: resultMatrixColumns.MY_NEW_COLUMN.NAME

  5. Do the same with the FORMAT definition below in the return statement of the element. Find .withColumnFormats call on that resultMatrix variable and add your new column FORMAT as a new Map entry, for example:
    resultMatrixColumns.MY_NEW_COLUMN.NAME : resultMatrixColumns.MY_NEW_COLUMN.FORMAT]

  6. 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.

  7. 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.

  8. 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 call decodedOutputs.getAt("Name of the Output Element")?.result. decodedOutputs is the variable that should be used to read the output values.

  9. 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

  10. Verify the visibility of the newly added Column(s) on the Dashboard.