Hi,
I'm trying to use the setFormat() API to change the display format of particular measures. If you look at the attached screenshot you'll see that we have a measure called "Expected" which is underneath "Fact Claim". I've tried using "pivot.setFormat(formatCurrency, "Expected", "sum");" and "pivot.setFormat(formatCurrency, "Fact Claim.Expected", "sum");" to change the formatting of this measure but neither seems to work. I've tried it with and without the aggregation parameter.
My formatCurrency object looks like this:
var formatCurrency = {
name: "currency",
thousandsSeparator: ",",
decimalSeparator: ".",
decimalPlaces: 2,
maxDecimalPlaces: 2,
maxSymbols: 20,
negativeNumberFormat: "-1",
currencySymbol: "$",
negativeCurrencyFormat: "-$1",
positiveCurrencyFormat: "$1",
isPercent: false,
nullValue: "",
infinityValue: "Infinity",
divideByZeroValue: "Infinity",
textAlign: "right",
beautifyFloatingPoint: true
};
I've seen in the demos for setFormat that the measures being passed to it are all top level ones and not underneath something else like what we have here with Fact Claim -> Expected. Is there a special way to pass the measureName parameter to setFormat in this type of case?
Hello, Darius,
Thank you for reaching out to us.
Please note that in your case, setFormat
method requires receiving the unique name of the field. We suggest checking how the field is defined, for example, in the Slice and using this name to set the format. Please have a look at the following JSFiddle for reference: https://jsfiddle.net/flexmonster/umn95t70/
On the sample below, we set format like this:
flexmonster.setFormat(formatCurrency, "[Measures].[Internet Total Product Cost]");
Please let us know if it works for you. Feel free to contact us if other questions arise.
Kind regards,
Nadia
Ok thanks for your assistance. I had to use your getAllMeasures API to find the proper unique name to use for setFormat and it appears to be working now!
Thanks,
Darius