Comma as decimal separator

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
gerardus
Posts: 20
Joined: 2013-11-11 08:29

Comma as decimal separator

Post by gerardus » 2021-11-03 17:51

Hi all,

I'm using AppGini v5.98.

I have a table with 5 fields DECIMAL (12,3) and I need to be able to use comma as a decimal separator and point as thousands separator.

I tried using the format "Points for thousands and comma for decimals, 2 decimals (example: 21.345,67) that comes in the format list but it doesnt work.

If I enter the numbers with a comma as a decimal separator the number gets truncated after the comma.

e.g. 21,345 -> 21,000 and it's displayed with a point -> 21.000.

Then I don't know if the point is the decimal separator and the value is 21 or it's the thousands separator and the value is 21000.

Modifying or creating another format based on this one (FORMAT(%%FIELD%%, 3, 'de_DE') for example) doesn't work either.

With that format, using a point as a decimal separator seems to work.

Am I doing something wrong or the decimal and thousand separator thing is broken?

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Comma as decimal separator

Post by pbottcher » 2021-11-04 11:14

Hi,

as far as I remember the format you choose withing AppGini is applied for the tableview (only).

If you want to be able to enter data into your input field that allows you to enter data with thousand separator and comma as deciamal separator,
you will need to convert that within the hook (before_insert / before_update)

Also you can use javascript to display your data on the form in the way you want.

Have a look at viewtopic.php?t=4297
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

gerardus
Posts: 20
Joined: 2013-11-11 08:29

Re: Comma as decimal separator

Post by gerardus » 2021-11-04 11:59

Hi,
thanks for your reply, I'll have a look at the solution.
It may be related, do you know why calculated fields appear with more decimals than the number of decimals that are stored in the BD?
If I define a field DECIMAL (12,2) and set it as calculated, it shows with 5 digits after the decimal point both in the tableview and the detail view.
If I look at the record in the DB the value is correct, with only two decimals.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Comma as decimal separator

Post by pbottcher » 2021-11-04 16:13

Hi,
did you try to rebuild your fields. Maybe there is a mismatching field definition.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

gerardus
Posts: 20
Joined: 2013-11-11 08:29

Re: Comma as decimal separator

Post by gerardus » 2021-11-04 18:21

I just tried deleting the field and recreating it and it does the same. :(

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Comma as decimal separator

Post by pbottcher » 2021-11-05 16:50

Hi did you check the settings on your database for that field.

And try to run the rebuild fields to see if that gives you a hint.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

SkayyHH
Veteran Member
Posts: 425
Joined: 2015-04-27 21:18

Re: Comma as decimal separator

Post by SkayyHH » 2021-11-06 07:35

How do you actually do it with fields that are calculated? In AppGini we cannot set a data format if the field has a calculation.

I can't figure out how to set a german data format in the calculation.

Can someone give me a tip here?

The calculation is:

Code: Select all

select TIMESTAMPDIFF (day, start, end) -days_correction +1 as days from absence_de where id =% ID%
Thanks much!

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Comma as decimal separator

Post by pbottcher » 2021-11-08 21:59

Hi,

can you explain what you would expect as a result. Your statement seems to return an integer value. So where shall that be formated?

Have a look at the mysql FORMAT(myNumber, decimals, 'de_DE') statement.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply