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?

Comments

  • Alex IpAlex Ip Australia
    edited 3:13AM
    I know it"http://www.fast-report.com/en/forum/?p=/discussion/comment/22026"; ] http://www.fast-report.com/en/forum/?p=/discussion/comment/22026 [/url].

    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.

    putukaca wrote: »
    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?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.