Need a special offer?Find out if your project fits.
+

how to change measure via API

Answered
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)

Thanks
Paul

2 answers

Public
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 https://jsfiddle.net/Uaman23/n7gaLr1w/ .
Let us know if it fits your need.
Best regards,
Dmytro.

Public
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: https://jsfiddle.net/flexmonster/8d5on276/
Regards,
Tanya

Please login or Register to Submit Answer