Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I am having an issue when trying to format a measure field when creating a pivot table visualization on-the-fly. The definition of the measure is:
{
"qDef": {
"qLabel": "Value",
"qDef": "Sum(Value)",
"qNumFormat":{
"qType":"F",
"qnDec": 2,
"qUseThou": 1,
"qFmt": "# ##0",
"qDec": ".",
"qThou": " "
}
}
}
I would like to format the number so that it shows the thousand separator as a space and displays 2 decimal places, but I have tried various options and it is always displayed with 3 decimal places and no thousand separator. I assume that hs qNumFormat is being ignored for some reason. Anyone have any ideas?
Thanks in advance.
Hi Erik,
The setOptions method worked.
var strPivotMeasureFormat = {
"qHyperCubeDef":
{
"qMeasures":
[
{
"qDef": {
"qLabel": "Value",
"qDef": "Sum(Value)",
"qIsAutoFormat": false,
"qNumFormat":
{
"qType": "F",
"qnDec": 2,
"qUseThou": 0,
"qFmt": "# ##0.00;0;",
"qDec": ".",
"qThou": " "
}
}
}
]
}
};
....
app.visualization.create(
"pivot-table",
strPivotDef,
{
"qHyperCubeDef":{
"qNoOfLeftDims": 7,
"qAlwaysFullyExpanded":true,
"qIndentMode":false
},
"showTitles": true,
"title": strDataExplorerTableTitle + " " +strSelections
} ).then(function(pivot)
{
console.log('pivot',pivot);
pivot.show('pivotExplorer');
pivot.setOptions(
strPivotMeasureFormat
);