Insert a BR (R$) Currency in dataFormats.cfg

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
User avatar
Marcelo Vitoria
Veteran Member
Posts: 60
Joined: 2016-10-11 12:08

Insert a BR (R$) Currency in dataFormats.cfg

Post by Marcelo Vitoria » 2018-07-30 19:29

Hello friends

I need to set the money display mask to the Brazilian default (R$), so I need to add a mask in the dataFormats.cfg that
either as: number_format($num, 2, ',', '.');

resulting for example:

The value at US $ 100,000.50

It would become R$ 100.000,50

How should I proceed? Will it also change the input method of values in the application?

Thank you
Marcelo Vitoria
Coding since 1984 Basic Sinclair!
Clipper Summer´87 - Visual Foxpro - VB6 - PHP
AppGini 24.11 - AdminLTE
https://www.workspaceservices.com.br

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

Re: Insert a BR (R$) Currency in dataFormats.cfg

Post by pbottcher » 2018-07-30 21:46

Hi,

you can try to add this for the value only

Code: Select all

numberformat 2 decimals; REPLACE(REPLACE(REPLACE(FORMAT(%%FIELD%%, 2), '.', ':'), ',', '.'), ':', ',')

It will only change the display in the table-view. In the detail view you need to take care of the conversion and possible calculations via the js hook.
To convert the data back correctly for the database you will need to handle the data in the hooks/<tablename>.php file <tablename>_before_insert and <tablename>_before_update functions.
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.

User avatar
Marcelo Vitoria
Veteran Member
Posts: 60
Joined: 2016-10-11 12:08

Re: Insert a BR (R$) Currency in dataFormats.cfg

Post by Marcelo Vitoria » 2018-07-31 14:55

Hello pböttcher,
Thanks a lot for the help.

I'll try to implement.
Marcelo Vitoria
Coding since 1984 Basic Sinclair!
Clipper Summer´87 - Visual Foxpro - VB6 - PHP
AppGini 24.11 - AdminLTE
https://www.workspaceservices.com.br

Post Reply