Get Free Trial

how to change measure via API

Paul Schlichter asked on August 18, 2016

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)


2 answers

Dmytro Zvazhii Dmytro Zvazhii Flexmonster 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,

Tanya Gryshko Tanya Gryshko Flexmonster December 5, 2016

Hello Paul and all Flexmonster users,
Please note that report structure was changed in version 2.3. Read more about new structure: Report Object. Here is an updated sample:

Please login or Register to Submit Answer