wrong result when using sum fuction
hiiii
i use delphi7, mysql, Zeos (as connection), fast report 3 trial and i have data in my table, it's call tSale and it's contain:
product qty total
A 1 1500
B 1 2000
A 1 1500
A 1 1500
C 1 2500
B 1 2000
and with this query: Select product, sum(qty) as QTY, sum(total) as TOTAL from tSale group by product and i get data as follow:
product QTY TOTAL
A 3 4500
B 2 4000
C 1 2500
and in my report i put those at masterdata band. i want to get total (i use SUM fuction) of QTY and TOTAL and i put it in page summary band. but as result i get for QTY is 321 and TOTAL is 450040002500 not 6 and 11000. i don't know why, have i made some mistake. any one can help me?
i use delphi7, mysql, Zeos (as connection), fast report 3 trial and i have data in my table, it's call tSale and it's contain:
product qty total
A 1 1500
B 1 2000
A 1 1500
A 1 1500
C 1 2500
B 1 2000
and with this query: Select product, sum(qty) as QTY, sum(total) as TOTAL from tSale group by product and i get data as follow:
product QTY TOTAL
A 3 4500
B 2 4000
C 1 2500
and in my report i put those at masterdata band. i want to get total (i use SUM fuction) of QTY and TOTAL and i put it in page summary band. but as result i get for QTY is 321 and TOTAL is 450040002500 not 6 and 11000. i don't know why, have i made some mistake. any one can help me?
Comments
The problem I had was caused by the function frGetFieldValue in the frx2xto30.pas unit assigning the DisplayText (string) value to the variant instead of the Int64 value for TLargeintFields. This meant that the sum function was concatenating strings instead of adding Int64 values.
You have probably given up or found a way around the problem already, but I thought I'd post this in case someone else finds this thread.
Regards,
Alex.