cancel
Showing results for 
Search instead for 
Did you mean: 

SDK: FormatString not set in Datasource (data.dimensions[].members[].formatString)

Former Member
0 Kudos

Hi,

i have a SDK component which uses the format strings passed by the data source to format the values.

To format the values, i use the following (prosa)code:

var formatString = datasource.dimensions[].members[].formatString;

var formattedValue = sap.common.globalization.NumericFormatManager.format(value, formatString);

The problem is, that sometimes the formatString is not set although the same measure is used.

FormatString is set:

FormatString is not set:

In BO DS 1.5 decimal places are set as shown here:

Is this a bug or does someone has an idea how to fix it?

Thx a lot.

Accepted Solutions (0)

Answers (2)

Answers (2)

Karol-K
Advisor
Advisor
0 Kudos

Hi,

for formatted data, you can configure it in the result set property spec.

http://help.sap.com/businessobject/product_guides/AAD16/en/ds_16SP01_dev_guide_en.pdf

page 34,

includeFormattedData - If true then the JSON property formattedData is included in the Data Runtime JSON. It contains the formatted data values as strings.

for the initial issue, we had internal issue on this topic - it is closed in the meantime, the result is a clarification (no correction):

the format string is only sent if it would be identical for all cells that is would apply for - shortly for all data cells with the corresponding measure.


However, it can happen that cells have different currencies or units - and thus there is no common format string for all cells of the measure. In this case, there is no formatString sent.


If you need formatted data in such case, use the inludeFormattedData option and directly use the formattedData array.

please check if this clarifies also your case.

Karol

Former Member
0 Kudos

Hi Karol,

includeFormattedData is not the solution - try to imagine case when you receive data set, but you want to show only selected part and summary of this part. In this case you have to calculate this sum in JavaScript. At the end you want to use the same format as for the rest values in received data set.

"the format string is only sent if it would be identical"  -> I'm 100% that all cells have the same format string, nevertheless formatString is empty.

I use: sap.common.globalization.NumericFormatManager.format function to set format.

Question is, do we have function to get format from formatted value (from string e.g. "1'234.76 $")?

Then I can read format and set for sum.

BR

Former Member
0 Kudos

Hi Fred,

I'm having the same issue, have you found a way to resolve it?

I'm going to default a formatString if I don't find one, but I know this won't be a catch all solution.

Thanks!

Scott