Dear visitor, despite the COVID-19 outbreak, our team continues operating at full speed.

Also, here is the form where you can apply for a special discount and we will contact you with possible options. Stay safe and continue achieving your business goals.

Fill the form
Get Free Trial
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)

Thanks
Paul

2 answers

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