Skip to content

decimal versus comma

Forums Forums SIMPOL Programming decimal versus comma

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #80
    Ian Macpherson
    Participant

    hello to all In France everybody uses the decimal point as a number/decimal separator & the comma for thousands This is perhaps therefore a local problem as I don’t really know what happens in the UK or the USA. Even Microsoft had to put up with it & the decimal point is automatically converted to a comma in Excel !! One of my SB30 converted files had a VAT rate field (2.1% or 5.5% or 19.60%) & when I converted the file & its form to Simpol the value showed up in the Personal in Record View as 19,60 ( comma) but the display format in the SIMPOL file definition shows up as z00.00. If I open the form in Personal ( I use an option group for the different VAT values) & scroll through the option button lights up fine BUT if I then open the same form in my app in the IDE the option group shows nothing. Of course I defined the SBLNumSettings to use the decimal point & comma in the same way as SB 30 had done it. HOWEVER if I create a new record in the app & click on say the 19.60 option group button & save then the option button in the app lights up for the new record but not as I said before for the older ones. IF I then go back into Personal to look at the new record it shows ##.## in record view & if I modify the file definition to z0000.00 it shows 1960,00 I tried doing it programming wise by removing the onselect values in the option group & testing the button’s STATE and putting a .fix(1960/100,100) instead but it gives the same result. This seems crazy to me… as if Personal & the IDE had compatibility problems … and why should numbers appear with decimals if the file display format says 00.00 ?? Anybody encountered this please ??

    #1510
    Michael
    Keymaster

    On 13/05/2013 13:47, Ian Macpherson wrote:
    > hello to all
    > In France everybody uses the decimal point as a number/decimal separator &
    > the comma for thousands This is perhaps therefore a local problem as I
    > don't really know what happens in the UK or the USA. Even Microsoft had to
    > put up with it & the decimal point is automatically converted to a comma
    > in Excel !!

    Hi Ian,

    In Germany also they use a comma for a decimal separator and a dot for the thousands separator, unlike the US and UK where the
    opposite is true.

    > One of my SB30 converted files had a VAT rate field (2.1% or 5.5% or
    > 19.60%) & when I converted the file & its form to Simpol the value showed
    > up in the Personal in Record View as 19,60 ( comma) but the display format
    > in the SIMPOL file definition shows up as z00.00. If I open the form in
    > Personal ( I use an option group for the different VAT values) & scroll
    > through the option button lights up fine BUT if I then open the same form
    > in my app in the IDE the option group shows nothing. Of course I defined
    > the SBLNumSettings to use the decimal point & comma in the same way as SB
    > 30 had done it.

    The question here is what have you passed to your app.SBLLocale.numsettings variable when it is initialized? As for file
    definition, it always shows you the correct string, which always uses the the dot for decimal separator and the comma for the
    thousands separator. Internally in SIMPOL, we always use these values. The only place this changes is when dealing with user
    input, which has to be sensitive to locale. So there are functions like val2string() and fieldval2string() that take a numlocale
    (SBLNumSettings) object. This has the various properties, like DecimalSeparator and ThousandsSeparator. All patterns passed to
    STR() still expect the format string to use the dot for decimals and a single comma to indicate you wish to use thousands
    separators. What the decimal and thousands separator will be, is dependent on the values in the numlocale.

    > HOWEVER if I create a new record in the app & click on say the 19.60
    > option group button & save then the option button in the app lights up for
    > the new record but not as I said before for the older ones.
    > IF I then go back into Personal to look at the new record it shows ##.##
    > in record view & if I modify the file definition to z0000.00 it shows
    > 1960,00
    > I tried doing it programming wise by removing the onselect values in the
    > option group & testing the button's STATE and putting a .fix(1960/100,100)
    > instead but it gives the same result.
    > This seems crazy to me… as if Personal & the IDE had compatibility
    > problems
    > … and why should numbers appear with decimals if the file display format
    > says 00.00 ??
    > Anybody encountered this please ??

    Don't mix up the internal representation (which always uses English language/US/UK format) and what the user is entering. In
    Personal in France it sounds like if you want to have a value of 19.60, then you need to enter 19,60. If there is a problem
    anywhere it may be in the way that the option button is dealing with the value, but I would need more information to be sure,
    since all of these assignments and comparisons for the UI use the exact same set of functions.

    Ciao, Neil

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.