how to change measure via API

I would like to switch to a different measure by clicking a button (API)
Here is the scenario:

  1. keep current rows and columns of loaded report
  2. change only the measure to a different available measure (amttotal to amtprod). Both measures are available but amtprod is inactive by default)


1 answer

Dmytro Zvazhii Staff August 19, 2016

Hi Paul,
Thank you for your question. At first you should use getReport() method to get the report object (var report = flexmonster.getReport();). Then you should set measures attribute as you want it to be (report.measures = [{ uniqueName: “Quantity”, aggregation: “sum”, active: true}, …];). After that please pass the updated report to the pivot (flexmonster.setReport(report);). The result will look like this .
Let us know if it fits your need.
Best regards,

Please login or Register to Submit Answer