What resultType parameter to use to display chart created with chart builder API?
Question
What will be the value of the "resultType" parameter to display a chart (i.e., waterfall, scatter, time series created using the chart builder API) from the Quote header? For example, to display a data table in the Quote header, the "resultType" parameter value is "MATRIX", for gauge it is "GAUGE". What will be the value for charts? The output field is created using the addOrUpdateOutput
method.
qp.addOrUpdateOutput(folderId, ["resultName": "Deal Performance",
"resultLabel": "Deal Performance",
"resultType": ??
"result" : waterfallChart])
Answer
Check out this sample:
def customerId = quoteProcessor.getHelper().getRoot().getInputByName("Customer")?.value
if (quoteProcessor.isPostPhase() && customerId){
quoteProcessor.addOrUpdateOutput("ROOT", ["resultName": "RevenueMargin",
"resultLabel": "Revenue vs Margin",
"result": lib.charts.generateRevenueMargin(customerId, null),
"formatType": "COMPLEX",
"userGroup" : "KeyUsers",
"resultType":"BAR",
"resultGroup":"Customer Sales History"
]
)
quoteProcessor.addOrUpdateOutput("ROOT", ["resultName": "SalesHistory",
"resultLabel": "Aggregated Sales History",
"result": lib.charts.generateSalesHistory(customerId, null),
"formatType": "COMPLEX",
"userGroup" : "KeyUsers",
"resultType":"DATATABLE",
"resultGroup":"Customer Sales History"
]
)
}
These are some of the other resultTypes available for use:
package net.pricefx.common.api;
public enum CalculationResultType {
SIMPLE,
MATRIX,
GAUGE,
QUOTE,
CONTRACT,
REBATEAGREEMENT,
WORKFLOW,
CONFIGURATORENTRY,
FLEXCHART,
DASHBOARD,
REBATERECORD,
DASHBOARDCONTROLLER,
CONFIGURATORENTRYARRAY,
COMPOSITEFLEXCHART,
COMPOSITEOFSIMPLE,
PAQUERY
}
Values such as "Waterfall" work too, if you specify "formatType": "Complex"
.
Found an issue in documentation? Write to us.