How to call 'Add Calculated Value' option?

Answered
Ravi asked on May 29, 2019

Hi Team,
I’m a Premium licensed user.
 
Is there a way to call ‘Add Calculated Value‘ dialog(in ArrangeField tool) at custom?

5 answers

Public
Tanya Gryshko Flexmonster May 29, 2019

Hello, Ravi,

Thank you for writing to us.

We can add a new API call capable of opening this pop-up window at custom. It can be added on July the 1st. Would this work for you?

Please keep in mind, that by default, a Field List is opened as soon as a pop-up window for calculated values is closed. This allows confirming the current slice with the new values added. Does this behavior suit your needs or would you rather prefer a new value to be added to the grid automatically?

Waiting for your feedback.

Regards,
Tanya

Public
Ravi May 30, 2019

Hi Tanya,
Thank you for your response.
 
Avoid opening ‘Field List’ after ‘Calculated Value’ popup.
And actually, we are preferring a ‘new value to be added to the grid automatically’. Please make this as possible.
 

Public
Vera Didenko Flexmonster May 30, 2019

Hello, Ravi,
 
Thank you for your reply.
 
Your feedback is very important to us.
 
Our team will take your remarks into consideration while working on this feature.
 
You can expect the new API call to be available in the minor release with the ETA 1st of July as before.
 
Please let us know if you have further questions.
 
Best Regards,
Vera

Public
Vera Didenko Flexmonster July 2, 2019

Hello, Ravi,
 
We are glad to inform you that a new openCalculatedValueEditor() API call was added. It allows opening calculated value pop-up window editor.
 
This is available in the 2.7.9 version of Flexmonster: https://www.flexmonster.com/release-notes/
 
You are welcome to update the component: https://www.flexmonster.com/doc/updating-to-the-latest-version/ 
 
 
Please let us know if everything works fine for you.
 
Best Regards,
Vera

Public
Vera Didenko Flexmonster July 3, 2019

Hello, Ravi,
 
 
We would like to provide some information about how the openCalculatedValueEditor API call is used.
 
 
Below are more details about this new API call.

openCalculatedValueEditor(uniqueName:String, callbackHandler:Function|String)
 
Both parameters are optional, calling openCalculatedValueEditor() will open an empty editor.
 
Parameters description:
uniqueName – String. The unique name of calculated value (for editing/deleting).
callbackHandler – Function|String. A function that is called after an action (clicking Apply/Delete button). 

The callbackHandler takes the response object with the following properties:
   — uniqueName – String. The unique name of the calculated value.
   — isRemoved – Boolean. Specifies whether the calculated value was removed (true) or not (false).
 
For example, if you would like for the newly created calculated value to be added to the grid, simply specify the callback handler:

pivot.openCalculatedValueEditor('', function(response){

// 1. Get the current slice
let slice = pivot.getReport().slice;

// 2. Find and activate the newly created calculated value
(slice.measures).find(measure=>measure.uniqueName==response.uniqueName).active = true;

// 3. Run query with the modified slice for the changes to take place
pivot.runQuery(slice);

});

 
Here is a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/q2z3ejwp/
 
 
Please let us know if you have any further questions.
 
Best Regards,
Vera

Please login or Register to Submit Answer