Numbers format

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
Moh Youba
Posts: 15
Joined: 2017-03-12 09:31

Numbers format

Post by Moh Youba » 2018-04-18 23:27

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

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 215
Joined: 2018-04-01 10:12

Re: Numbers format

Post by pböttcher » 2018-04-19 07:32

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

Moh Youba
Posts: 15
Joined: 2017-03-12 09:31

Re: Numbers format

Post by Moh Youba » 2018-04-19 09:50

Hi

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

Regards,

Post Reply