Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
rbartley
Specialist II
Specialist II

Visualization API - Numeric formatting in pivot table

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.

10 Replies
rbartley
Specialist II
Specialist II
Author

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

);