Page 1 of 1

Data Format not applied to Looking Field value

Posted: 2024-11-15 15:49
by ppfoong
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.

Re: Data Format not applied to Looking Field value

Posted: 2024-11-15 16:23
by ppfoong
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.

Re: Data Format not applied to Looking Field value

Posted: 2024-11-16 11:31
by a.gneady
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

Re: Data Format not applied to Looking Field value

Posted: 2024-11-17 13:39
by ppfoong
Thanks. It works with SELECT FORMAT...