Data Format Bug

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
SkayyHH
Veteran Member
Posts: 425
Joined: 2015-04-27 21:18

Data Format Bug

Post by SkayyHH » 2015-04-28 12:06

Hello, i tried Data Format. There is a bug on Euro currency. We do not write €21,345.67, we use €21.345,67. Look at the comma and period. This is not correct on all formatings. I need a number like this: 1.200,00

Please fix this. Thanks much, kai

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2019-10-03 06:02

True!

Can this be fixed in the next release?

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Data Format Bug

Post by jsetzer » 2019-10-03 06:40

True, and you can change it by yourself as a workaround until it is fixed.

tl;dr (short instructions)
  1. Close AppGini
  2. Insert the following line into C:\Program Files (x86)\AppGini\add-ons\dataFormats.cfg:

    Code: Select all

    Währung Euro (custom) example: 21.345,67 €); CONCAT(FORMAT(%%FIELD%%, 2, 'de_DE'), ' €')
    
  3. Open your project in AppGini, select the new format and re-generate your app
Detailed step-by-step instructions
  1. Close AppGini
  2. There is a file called "add-ons\dataFormats.cfg" in the AppGini-installation directory.
    Mine is C:\Program Files (x86)\AppGini\add-ons\dataFormats.cfg
  3. Backup that file for your own safety.
  4. Open that file with your code editor
  5. Insert the following line:

    Code: Select all

    Währung Euro (custom) example: 21.345,67 €); CONCAT(FORMAT(%%FIELD%%, 2, 'de_DE'), ' €')
    
  6. Save the file and close it in your editor
  7. Open AppGini and load your project
  8. Select your table and field and open the data-format list.
    The new entry should be listed now
  9. Select the entry
  10. Save your project and generate your app
  11. Check the field
This works for me. Hope it helps!
Best,
Jan

PS: Remember to save your changes before updating AppGini next time
PPS: If I remember right, there is still a problem with input of numeric data for datatypes double, float and decimal. The input-field requires a point "." as decimal separator, not a comma ";". I have found a workaround in one of my German projects a year ago, and I will check if I can provide that hack in one of the next releases of AppGini Helper JavaScript Library.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2019-10-03 07:43

Thanks again Jan, It works good.
I changed it personally to this, the Euro-sign in front, thanks for the tip.

NL Euro (custom) example: € 21.345,67); CONCAT('&euro;&nbsp;', FORMAT(%%FIELD%%, 2, 'nl_NL'))


The other thing, that the "." is the decimal as input, that's still a problem, that was my next issue to solve/search.
So, if you could put that in the Helper Library, it would be great!

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Data Format Bug

Post by jsetzer » 2019-10-03 08:27

mekin wrote:
2019-10-03 07:43
The other thing, that the "." is the decimal as input, that's still a problem, that was my next issue to solve/search.
So, if you could put that in the Helper Library, it would be great!
I need to have a look how I did this last year.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

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

Re: Data Format Bug

Post by pbottcher » 2019-10-03 12:19

Hi,

it would have been easy to look at

viewtopic.php?t=1805

and

viewtopic.php?t=1278

Having read this you will see, that you need to take care of the conversion via the hooks files if you change the display on the webpage itself.
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.

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2020-04-20 08:37

Hello, I have been of the radar for sometime, now getting back and picking it up.

What was the problem with this thing again?
In the latest version of AppGini the info from Jan was applied, but what is the right Data type?
The decimals of my ammounts are not beeing saved, so €20,30 is going to €20,00

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2020-04-29 05:15

Hi, such a nice thing as AppGini, where everything is made easy, why can it be that this "simple" thing isn't in the package programmed.

I can't figure it out, tried alot of things, but I use AppGini because I'm not a web-developer, I'm just an IT-guy that needs simple DB's to create and use.
I don't want (and have) to spent alot of time in finetuning the configfiles or adding hooks, just to get the currency/decimal right, a thing that is used in half of the world.

Dear AppGini, can you please make a nice feature/solution to get this right, without us doing all things in AppGini config-files of hooks.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Data Format Bug

Post by onoehring » 2020-04-29 15:24

Hi,

either I read too quick, or you did not tell us: Have you set the correct data type in AppGini? For currency I would suggest decimal (integer can not hold any decimals).
ec_20200428_01.png
ec_20200428_01.png (10.69 KiB) Viewed 5734 times
Olaf

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Data Format Bug

Post by D Oliveira » 2020-04-29 15:45

if anyone is using Jan’s solution set the dataFormat.cfg file read-only after modifying it, in case you need to update appgini in the future and they havent addressed this issue, just something to keep in mind =) happy coding

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2020-04-29 17:19

Hi Olaf, it is set to Decimal.

@ D Oliveira, Jan's solution is in the newest version of AppGini, but it doesn't seems to work.

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

Re: Data Format Bug

Post by pbottcher » 2020-04-29 18:24

Hi,

maybe I misunderstand your request,

but if you want to enter a decimal number into the database you need to provide it with a . not a ,
so try 20.30 instead of 20,30.
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.

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2020-04-29 19:20

Hi, that's the problem in Europe, we have a comma (,) as a decimal sign.
So if my users put in an amount, they will saying 1,25 in stead of 1.25 (in text 1 euro and 25 cents)

And maybe it isn't a AppGini thing and it is how MySQL just saves it in de database and that's how it works.
Then my question would be, can AppGini provide a builtin function that does the translation van point to comma.

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2020-04-29 19:22

Also a funny thing: the original topic was made 5 years ago, so it is definitely time for a nice solution.

mekin
Veteran Member
Posts: 40
Joined: 2019-04-22 17:09

Re: Data Format Bug

Post by mekin » 2020-04-30 05:48

Ok, I have built a new DB and only an amount field with Decimal datatype and Euro-curreny dataformat (€21.456,78)

If I add a new record then there are different values that are shown:
Input = 10,50 - TableView = 10,00 - DetailView = 10.00 (rounds up and the decimal signs are different)
Input = 10.50 - TableView = 10,50 - DetailView = 10.50 (exact value and the decimal signs are different)

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Data Format Bug

Post by onoehring » 2020-04-30 06:28

Hi,

just try to add to /hooks/tablename.php -> _before_update function a check for the field and replace all . to , and vice versa. Try something like this

Code: Select all

$your_field_name = number_format($your_field_name,2,",",".");
or vice versa

Code: Select all

$your_field_name = number_format($your_field_name,2,".",",");
Olaf

Post Reply