How to change to my currency?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
User avatar
urichard
Veteran Member
Posts: 87
Joined: 2018-11-01 12:11

How to change to my currency?

Post by urichard » 2022-06-14 21:40

Hi,

Im in SA want to change to Zar with the R as symbol also in this format: R10 000.00

Kind Regards,
Richard
[email protected][/color]

Kind Regards
Richard

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

Re: How to change to my currency?

Post by jsetzer » 2022-06-14 22:06

You can create a custom data format in dataFormats.cfg:
https://bigprof.com/appgini/tips-and-tu ... ta-formats
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

User avatar
urichard
Veteran Member
Posts: 87
Joined: 2018-11-01 12:11

Re: How to change to my currency?

Post by urichard » 2022-06-16 14:35

Thank you Jsetzer,

I now have another problem, Im using northwind and when i want to add a data format of my currency to the calculated field it says i need to add the data format into the calculated field, what will that look like?

Kind Regards,
Richard
[email protected][/color]

Kind Regards
Richard

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

Re: How to change to my currency?

Post by jsetzer » 2022-06-16 14:49

(1) What is the datatype of your calculated field? Should be float, decimal or any other numeric data type.

Or you can use an alohanumeric type (like varchar or text) and do the formatting in your SQL command. But then values will ve strings and will contain separators and currency symbol as string, not number. This may lead to further casting and string conversion if you need those calculated values later on AS NUMERIC VALUE.

(2) there is a known issue with AppGini overwriting well formatted values in table view by unformatted values. I think AppGini does not apply the configured dataFormat after recalc. That's one reason I avoid using calculated fields but update values using SQL in _init hook or in before/after insert/update hooks.
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

User avatar
urichard
Veteran Member
Posts: 87
Joined: 2018-11-01 12:11

Re: How to change to my currency?

Post by urichard » 2022-06-16 16:25

Hi Jsetzer,

It was as a double type. I changed it to decimal but still doesnt allow me to change this format of the currency im In why can I not have it as a calculated field and then format that field with showing the correct currency?

I dont know how to change it in mysql but also dont really feel i should do it as it might cause problems down the road.

I would like to show the total with the currency symbol on at the least but the "R" symbol shouldnt be the new value but only an extra printed character that shows on the frontend and still leave the value calculated just as is as a number value.
[email protected][/color]

Kind Regards
Richard

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

Re: How to change to my currency?

Post by jsetzer » 2022-06-16 16:52

There are several different ways which will work. My recommendation in this case:

I assume calculation requires fields from the same table, only.

- copy SQL command from your calculated field
- disable calculated field
- ensure field is readonly
- ensure datatype is numeric
- select the desired data format
- generate app
- reload
- if necessary, rebuild fields
- in hooks/TABLENAME.php create a function which updates the value in the database according to your calculation
- call that function in TABLENAME_after_insert and in TABLENAME_after_update hook
- open a record in detail view and save (update) or create a new record and save (insert). Your function should be executed and record should be updated in database. Calculated result should be up to date now and formatted.
That's it.
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

User avatar
urichard
Veteran Member
Posts: 87
Joined: 2018-11-01 12:11

Re: How to change to my currency?

Post by urichard » 2022-10-13 09:59

Hi Tsetzer

Where do i go to access mysql and to make these changes? Where do i insert the formulas on mysql and what formulas or calculations is allowed?
[email protected][/color]

Kind Regards
Richard

Post Reply