Topic: cf field not showing 2 decimals

Hi,
what i do wrong , field type currency not showing 2 decimals.

printf("%.2f",  
(SELECT sum(Total) FROM TableLines WHERE id_TableOrders = TableOrders.id)
)            
Post's attachments

Attachment icon IGMAeng29052025_1803.zip 1.65 mb, 92 downloads since 2025-05-29 

2 (edited by k245 2025-05-30 08:27:28)

Re: cf field not showing 2 decimals

functions are processed within the SELECT command

( 
SELECT printf("%.2f",  sum(Total) ) FROM TableLines WHERE id_TableOrders = TableOrders.id)
)  
Визуальное программирование: блог и телеграм-канал.

Re: cf field not showing 2 decimals

Hi,
i use your code but still not showing 2 decimals

Post's attachments

Attachment icon 2025-05-30 10_51_29-Window.jpg 147.9 kb, 43 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

You try chose Field type (TEXT)  in CfTotal  not Real

Post's attachments

Attachment icon total.PNG 9.28 kb, 41 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

the result like this  315.00

Post's attachments

Attachment icon cf.PNG 49.29 kb, 37 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

Hi
thank you for answer, i try it but nothing cannot get decimals

Post's attachments

Attachment icon IGMAeng30052025_1336.zip 1.7 mb, 90 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

here is screenshot

Post's attachments

Attachment icon 2025-05-30 13_34_31.jpg 168.42 kb, 37 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

I send fixed file  your project

Post's attachments

Attachment icon IGMAeng29052025_1803.rar 1.32 mb, 91 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

Hi,
thank you but again nothing
sad

Re: cf field not showing 2 decimals

in calculate field  file Type  choose type (TEXT)  don.t CURRENCY

Post's attachments

Attachment icon cf.PNG 11.51 kb, 40 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

ohhh, thank you

Re: cf field not showing 2 decimals

Hi
now when i change to text sum not working then,look at screenshot

Post's attachments

Attachment icon 2025-05-30 17_36_06.jpg 75.2 kb, 37 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

Hi Igor, Hi Agusecc,
Works perfectly for me - deleted invoices, added new orders / invoices, tested for displaying 9.99, 9.90 and 9.00 and everything appears correct (see attached).
Derek.

Post's attachments

Attachment icon igor.jpg 112.16 kb, 39 downloads since 2025-05-30 

14 (edited by sparrow 2025-05-30 19:21:15)

Re: cf field not showing 2 decimals

Hi Derek, Agusecc, k245


There is no error in the calculated field.
I have a different decimal separator. There is indeed a difference.

He can use:

procedure FormMain_TableGridInvoices_OnChange (Sender: TObject);
begin
  TNxNumberColumn(FormMain.TableGridInvoices.Columns[9]).FormatMask := '#,##0.00';
end;

And I think you can do without printf in the calculated field.

Re: cf field not showing 2 decimals

Hi all,
very nice sparrow, this works
Thank you all

Post's attachments

Attachment icon 2025-05-30 21_27_02.jpg 14.14 kb, 43 downloads since 2025-05-30 

Re: cf field not showing 2 decimals

Hi Sparrow,
You have excellent eye-sight to spot the ',' instead of '.'!  big_smile
Derek.

Re: cf field not showing 2 decimals

derek wrote:

Hi Sparrow,
You have excellent eye-sight to spot the ',' instead of '.'!  big_smile
Derek.


This is only in glasses )))))))) And they still need to be found ))))
But seriously, these periods and commas like to present surprises in our regional standards.