Need a special offer?Find out if your project fits.
+

General formatting questions.

Answered
Jeremy Deats asked on April 4, 2016

I'd like to know how to set global formatting settings/defaults. The problem we're facing is that measures are appearing like this
"4 424 600.512416353", notice there are no commas and 9 point decimal inclusion. We are looking for all numeric values to have commas and two decimal places (e.g. "4,424,600.51" with the option for the user to apply additional formatting like currency symbol, etc... I have read here to use useOLAPFormatting=true in <params> but I'm not sure where to apply this as we're not using a report.xml file to start. Initially all these settings are set in HTML using the var config = { ... }. Adding useOLAPFormatting: "true" or useOLAPFormatting: true does not solve the problem.
Jeremy

2 answers

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster April 4, 2016

Hi Jeremy,
 
 
If you already have formats defined for measures in OLAP cube and you want to use them, please set useOLAPFormatting report property to true to enable this, as follows:

var report = {
dataSourceType: "microsoft analysis services",
proxyUrl: "http://olap.flexmonster.com/olap/msmdpump.dll",
cube: "Adventure Works",
catalog: "Adventure Works DW Standard Edition",
configuratorActive: true,
rows: [{uniqueName: "[Product].[Category]"}, {uniqueName: "[Reseller].[Business Type]"}],
columns: [{uniqueName: "[Measures]"}],
measures: [{uniqueName: "[Measures].[Reseller Order Count]"}],
expandAll: true,
drillAll: true,
useOLAPFormatting: true
};

flexmonster.embedPivotComponent("", "pivot-content", "100%", "600", report, true);

 
Also, there is a way to set a default number format for the report in the component. Please define a format with the empty name in report object for this, as follows:

var report = {
dataSourceType: "microsoft analysis services",
proxyUrl: "http://olap.flexmonster.com/olap/msmdpump.dll",
cube: "Adventure Works",
catalog: "Adventure Works DW Standard Edition",
configuratorActive: true,
rows: [{uniqueName: "[Product].[Category]"}, {uniqueName: "[Reseller].[Business Type]"}],
columns: [{uniqueName: "[Measures]"}],
measures: [{uniqueName: "[Measures].[Reseller Order Count]"}],
expandAll: true,
drillAll: true,
formats: [{name: "", decimalPlaces: "2", thousandsSeparator: ","}]
};

flexmonster.embedPivotComponent("", "pivot-content", "100%", "600", report, true);

More properties of number formatting (currencySymbol, etc.) can be found here http://www.flexmonster.com/doc/number-formatting/
 
Please let me know which suggestion works for you.
 
Kind regards,
Iryna

Public
Tanya Gryshko Tanya Gryshko Flexmonster December 7, 2016

Hello Jeremy and all Flexmonster users,
We would like to inform you that starting from version 2.3 the structure of Report Object was changed. It is backward compatible but nevertheless we would recommend you to check the changes in our Migration guide. Also, please have a look at our Number formatting article with updated examples.
Regards,
Tanya

Please login or Register to Submit Answer