removeAllCalculatedMeasures and addCalculatedMeasure not working

Answered
Meir Hadassi Turner asked on December 30, 2017

Hello,
The  removeAllCalculatedMeasures and addCalculatedMeasure are not working, even in the jsfiddle: https://jsfiddle.net/flexmonster/79keh0ee/
Can you please advise.

6 answers

Public
Dmytro Zvazhii Flexmonster January 2, 2018

Hello Meir Hadassi,
Thank you for your question. Could you please check the jsfiddle again https://jsfiddle.net/flexmonster/79keh0ee/ . It seems that removeAllCalculatedMeasures and addCalculatedMeasure methods are working fine. The difference is that they were called from global flexmonster object, when Flexmonster Pivot component is assigned to the local pivot object. Therefore when you call these methods from pivot object everything should be working fine.
Please let us know if you have any additional questions.
Regards,
Dmytro.

Public
Dmytro Zvazhii Flexmonster January 2, 2018

Hello Meir Hadassi,
Please have a look at the following video example – https://www.screencast.com/t/DwP4kEWdgQ
Let us know if everything works fine for you.
Regards,
Dmytro.

Public
Vasu May 30, 2019

Hi Dmytro, 
We were able to add calculated measure by clicking on a button, and we can see that in arrange fields popup. How do we add calculated measure directly to the grid? without user going into arrange fields popup.
 
Thanks,
Vasu.

Public
Vera Didenko Flexmonster May 31, 2019

Hello, Vasu,
 
Thank you for pointing this out to us.
 
We would like to confirm that this is not the intended behavior.
 
Our team has added this request to our backlog and we will notify you as soon as we have any updates.
 
As a workaround, we kindly advise using the getReport() and setReport() API calls:

1) Get the current report:

var newReport = pivot.getReport();

 
2) Set the calculated value active:

newReport.slice.measures[1].active = true;

 
3) Set the new report:

pivot.setReport(newReport);

 
Here is a JSFiddle example for illustration.
 
Please let us know if you have further questions and if this works fine for you.
 
We are looking forward to hearing from you.
 
Best Regards,
Vera

Public
Vasu May 31, 2019

Hi Vera,
Thanks a lot for you response. Yes it works great now. 

one more question :).. 

Is there a way to launch “Add calculation value” window directly from a button click? 
we are trying to avoid multiple clicks to get to calculated values screen to improve usability.
Thanks,
Vasu.
 

Public
Vera Didenko Flexmonster June 3, 2019

Hello, Vasu,
 
Thank you for your reply.
 
We are glad to hear that the workaround works well for you.
 
Regarding launching “Add calculation value” window directly from a button click, we would like to mention that our developer team is working on a new API call for this purpose.
 
Please let us know if you have any further questions.
 
Best Regards,
Vera

Please login or Register to Submit Answer