Henry Olive 5 Posted December 29, 2024 Good Day Delphi 10,4 Table Field Values : (F1 = 95.615,79 , F2 = 6) In Firebird SQL i make a calculation like ( F1 * F2 ) as TOTAL and in my query result (In Delphi) = 573.694,74 which is correct I have an Aggregate Field in my CDS and it's Expression = SUM(TOTAL) In my table there is just 1 record and the Aggregate result = 573.694,73 What am i doing wrong ? Thank You Share this post Link to post
Serge_G 87 Posted December 30, 2024 How are your DataSet fields and Aggregate Field declared ? I think it's a rounding problem. Share this post Link to post
Henry Olive 5 Posted 14 hours ago Thank you Serge, Happy new year Price : Numeric(15,5) Qty : Numeric(15,2) Firebird,: Select Sum(Price * Qty) as Total (the result = 573.694,74 ) In Delphi I Created an Aggr.Field and its Expression is Sum(Total) (the result = 573.694,73 ) Thank You Share this post Link to post
Olli73 5 Posted 6 hours ago Try a Select Sum(Round(Price * Qty, 2)) as Total or Select Round(Sum(Price * Qty), 2) as Total And what is the FieldType in ClientdataSet? Share this post Link to post
Henry Olive 5 Posted 3 hours ago Thank you Olli73, Happy New Year Both Qty & Price fields are TFMTBCDField; Select Sum(Round(Price * Qty, 2)) as Total gives correct result Share this post Link to post