Get Free Trial

Calculated values not working due to unique name

cwoo asked on August 4, 2021

I have the grid set up as shown in If you look at the DisplayWeight (Custom) column, which is a calculated field, it doesn’t show any value.
I have narrowed down the cause of the issue, where it seems that this is due to the uniqueName  “DisplayWeightCustomPivotmeasure_f47b1256dbef41548d567931abf0bac” specified for the calculated field. If I change the uniqueName to something else, the column displays fine.
Is there a limitation on how uniqueName could be specified?
Chen Woo.

3 answers

Illia Yatsyshyn Illia Yatsyshyn Flexmonster August 5, 2021

Hello, Chen,
Thank you for posting on our forum.
Flexmonster does not imply limitations on the unique name of the calculated values.
However, please note that calculated fields should not be mentioned in the JSON meta-object (first object of the array). This object only serves to define fields that exist in the data set.
After removing the mentioned field from the meta-object values are shown as expected:
Please let us know if it helps.
Kind regards,

cwoo August 5, 2021

Thanks for the response. It works after I removed the field from the meta-object as you suggested. By any chance this behavior was changed in recent releases? I asked this because we have been doing this in our codebase for a while, and I assume our QA would have caught this issue when they tested calculated field.
The next question I have is that how do i customize a field, especially calculated field using a function to display a value in a custom format? I have looked at but it wasn’t clear to me on how to do this, specifically how do I target a specific cell.

Illia Yatsyshyn Illia Yatsyshyn Flexmonster August 6, 2021

Thank you for your feedback. We are happy to hear it works for you now.
We want to note that this behavior was not changed in recent releases of Flexmonster. Calculated values should be separated from the dataset itself by the initial design.
Concerning calculated field customization, we suggest checking out our Number formatting and Conditional formatting features which support calculated values along with other measures in your data source. These features allow diverse formatting and conditional customization of cells.
If even more custom logic is required, you can use the customizeCell hook mentioned in your question. It is easy to target the desired cells by configuring conditions inside the customizeCell handler. We suggest checking out Live examples of the pivot table component using the customizeCell hook for reference. Basically, you want to use the data parameters passed to the handler to distinguish which cells should be formatted and how. The mentioned data parameter contains Cell Data Object which provides full information about the cell, including its actual value, hierarchy membership, identifiers, etc.

Please let us know if it helps.
Also, it would help us a lot if you could create a separate forum thread for unrelated questions in the future.
Best regards,

Please login or Register to Submit Answer