Data Format not applied to Looking Field value

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
ppfoong
Veteran Member
Posts: 52
Joined: 2021-07-13 16:46

Data Format not applied to Looking Field value

Post by ppfoong » 2024-11-15 15:49

AG 24.18

I have a unit price from Product table. The unit price field is formatted for currency display using Data Format.

In the Invoice table, unit price is a lookup field from Product table, and this table has quantity and total price. Both unit price and total price are formatted for currency display using Data Format.

The unit price in Product table is displaying the currency symbol correctly.
The total price in Invoice table is also displaying the currency symbol correctly.
But there is no currency symbol for the unit price in Invoice table, which is a lookup field.

What is expected: the unit price in Invoice table can be formatted according to the Data Format setting for the field as well.

ppfoong
Veteran Member
Posts: 52
Joined: 2021-07-13 16:46

Re: Data Format not applied to Looking Field value

Post by ppfoong » 2024-11-15 16:23

I found out that currently, Data Format is not applicable for calculated field.

However, I discovered another bug.

All the fields are set to have a length of 10.2

The unit price displays 2 decimal place, which is correct.
The qty displays 2 decimal place, which is correct. I allow decimal place in qty, because the qty can be 0.5 and other non-integer value.
The total price displays 4 decimal place, which is not correct.

I checked inside MySQL database, the total price is stored as 2 decimal place.

User avatar
a.gneady
Site Admin
Posts: 1320
Joined: 2012-09-27 14:46
Contact:

Re: Data Format not applied to Looking Field value

Post by a.gneady » 2024-11-16 11:31

For calculated fields, you should apply the data formatting into the calculated field SQL query. You could use the SQL function FORMAT for that. For example: FORMAT(your_column, 2). This would format the number 1234567.8912 to 1,234,567.89. You can also pass a third parameter to this function to specify locale.

Reference: https://dev.mysql.com/doc/refman/8.0/en ... ion_format
:idea: AppGini plugins to add more power to your apps:

ppfoong
Veteran Member
Posts: 52
Joined: 2021-07-13 16:46

Re: Data Format not applied to Looking Field value

Post by ppfoong » 2024-11-17 13:39

Thanks. It works with SELECT FORMAT...

Post Reply