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

Move 2' dataset - from internal report

edited March 2010 in End User
Hi

I have a report with 3 dataset

Main dataset is DATASET1.

in detail of dataset1 i need a total of one field of all record of DATASET_A
and DATASET_B

i don't want print Detail notthing of DATASET2 / 3 ( no subreport )

How i can do it ?

Can i make a function inside RAD like this

funtion CalcDaset2_SUM:Integer;
begin
Result := 0;

Dataset2.Firt;
While Dataset2.Eof = False do
begin
Result := Result := +DataSet2['VALUE'];

Dataset2.Next;
end;
end;

and use this in BEFORE DETAIL GENERATE

Label1.Caption := IntToStr(CalcDaset2_SUM);

-----------------------------------


DATASET1 ( only one record )
A

DATASET_A
XXX 10
YYY 100
ZZZ 50

DATASET_B
AAA 20
BBB 200
CCC 10

i need only printed :
A 160 230

Comments

  • edited March 2010
    i have try to add un DBCALC component with DATAPIPELINE = DATASET_B and
    FIELD = 'VALUEFIELD'
    in main report.


    but dont' work , DBCALC work always in DATASET1
    DATASET_B is ignored ( Bug ? )



    i have try to add SUBREPORT ( DATASET_B) and a new DBCALC.
    DbCalc work fine , but i don't want new subreport printed , i need only 1
    band.
  • edited March 2010

    I recommend creating a summary query that contains the sum

    Example:

    select orders.custno,
    sum(orders.AmountPaid)
    from orders
    Group By orders.custno

    Then you can link that query to the main query and use a DBText to print the
    result on the report.

    If you prefer to write the code to iterate over the dataset, that is another
    option. However RAP does not know about the methods of TDataSet, therefore
    you will need to extend RAP. This is simple to do and is convered in the RAP
    tutorials and demos installed with ReportBuilder. Also here is an rbWiki
    article

    http://www.digital-metaphors.com/rbWiki/RAP/Extending_RAP/Overview

    The DBCalc connected to the detail datapipeline will not do anything unless
    you have report or child report connected to the datapipeline and generating
    detail.

    When designing any report there is always a trade off between doing more
    work in the data access versus the report layout step. If you process the
    data more, the report layout becomes simpler.




    Best regards,

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.