Page 1 of 1

Numbers format

Posted: 2018-04-18 23:27
by Moh Youba
Hello AppGini's family. Once again I need your help. I have this code on the hooks

sql("UPDATE clients SET credit ='$credit' WHERE idclient ='$id' ", $eo); - shows number like 1000000, I want to show like this 1 000 000

sql("UPDATE clients SET versement ='$versement' WHERE idclient ='$id' ", $eo);- shows number like 1000000, I want to show like this 1 000 000

sql("UPDATE clients SET balance ='$apayer' WHERE idclient ='$id' ", $eo);- shows number like 1000000, I want to show like this 1 000 000

Please any help will be really appreciated.

Thank you

Re: Numbers format

Posted: 2018-04-19 07:32
by pbottcher
Hi Moh,
as you refer to an Update to the DB I'm not sure what you mean by "I want to show like 1 000 000". Are you refering to the data being stored like this in the database, or do you want it in your app?

If you want to store it like this in you db you could use: sql("UPDATE clients SET credit =replace(format('$credit',0),","," ") WHERE ....

If you want to display it in you table-view you can use the dataformat for the fields (credit, versement, apayer). You need to update the file INSTALLATIONPATH_OF_APPGINI\add-ons\dataFormats.cfg and add a line like
Display Number as X XXX XXX; REPLACE(FORMAT(%%FIELD%%, 2), ',', ' ')

beaware that the representation only seems to work in the table view. I have opened a inquery at https://forums.appgini.com/phpbb/viewto ... =11&t=2655

Re: Numbers format

Posted: 2018-04-19 09:50
by Moh Youba
Hi

Thank you for your reply. I am going to test and back to you.

Regards,