Skip to Content
avatar image
Former Member

Edit Text write decimal value by different localization

Hello,

I have a problem to write a calculated price to a column in a matrix. I have already read many postings.

To Use the Replace function after converting the Double value to string is the right way.

But there are different behavior in different localizations.

For Example:

I have on my local machine 2 Database India localization and Sweden localization. My Idea was to get the decimal separator which is configured in SBO (Dot or comma). And After use the replace function of .Net. At first it seems to work. The first problem is that the Separator is not consistent.

I think it depends on localization which decimal separator is needed for the replace function of the double-string (India = dot and Sweden = comma). The second Problem is that i change the setting of the decimal separator from comma to dot and the other way round for testing. And suddenly my value 10.52 becomes to 1052 despite the fact that i get always the seperator from SBO before replace it in the string and write to Edittext Value. So i think it doesn´t matter what is configured in SBO i must be always one defined separator but how to find this information.

Maybe someone can help me to find a way to find out which decimal separator is needed.

My SBO is 9.2 PL 5.

Thanks a Lot.

Paul

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 04, 2017 at 05:14 PM

    Hi Paul,

    A suggestion, did you try to use SBObob object from DI API? There is a method called Format_MoneyToString. Maybe helps you.

    How to use:

    SBObob sboBob = oCompany.GetBusinessObject(BoObjectTypes.BoBridge);
    double i = 1012.5236;
    string b = sboBob.Format_MoneyToString(i, BoMoneyPrecisionTypes.mpt_Price).Fields.Item(0).Value;
    

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi together,

      I think I forgot some details:

      In my localization for India I create many UDF (BoFieldTypes.db_Float, BoFldSubTypes.st_Price) in Sales Order. Maybe the Problems occurs with this combination.

      I try the Format_MoneyToString function.

      Result is ->

      India:

      My calculated double Value is 10.52 and decimal separator in SBO is DOT(.). => Resultstring is also 10.52 -> OK.

      Change now the separator to comma in SBO. => Resultstring is 10,52 => NOK because after Write to Matrix in the Order the value is 105.200,0000 and that is wrong.

      So looks like the function also get the sepeartor from SBO and user replace function as well.

      I try also to fill the calculated value in standard sap price-column not only UDF. This seems to work with both separators as well.

      Sweden:

      In my Sweden localization it fill the calcuted double values only to SAP fields -> there are no UDF´s. The result is that it works with the Format_MoneyToString function with both separators as well.

      So it look like that this problem occurs when you fill double values to a UDF in a Matrix. The Matrix is changing something in the backround.

      Any ideas?

      Thanks

      Paul

  • Oct 05, 2017 at 01:57 AM

    Hi Paul,

    I suppose you did the calculation in a query run from a datatable?
    Not sure if this will help or still valid in your current SBO Version.
    It looks like matrix recognizes specific column names and auto format the value in matrix according to the datatable column name.
    You can try naming your data table column 'Price' and let the datatype in the datatable column as Double.

    I encountered this a few years back, not sure if still valid.

    Regards
    Edy

    Add comment
    10|10000 characters needed characters exceeded