Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

how to sum two sql queries total field

edited July 2004 in General
Hi...
Report Builder Pro 7
Delphi 7

I have a report with two sql queries included (created with the Designer and
saved as RTM file).
'Query1' prints numbers and, with a DBCalc, a SUM of those numbers.
'Query2' prints another numbers, and with another DBCalc, the sum of those
numbers.

?Is it possible to sum DBCalc1 + DBCalc2 without RAP or code?
?Is it possible to create another query that obtains data from Query1 and
Query2 results?

Thanks!

Comments

  • edited July 2004
    Hi Santy,

    1. Unfortunately there is not a built-in way to calculate the sum of two
    DBCalc components without using RAP or Delphi code. I would recommend using
    a TppVariable and the OnCalc event to calculate the TppDBCalc1.Value +
    TppDBCalc2.Value.

    2. Yes... this is definitely possible. This would be especially easy if
    you created a query that only contained one field and one record. For
    instance if you returned only the sum of the first field plus the sum of the
    second field, you could place this value on your report without the need to
    connect the dbpipeline to the report. Something like the following...

    SELECT SUM(Field1) + SUM(Field2)
    FROM Table1

    --
    Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
    Delphi Informant Readers Choice awards!

    http://www.delphizine.com/ballot2004/

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.