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

query rerun to create two reports in one print

edited March 2005 in General
I have a difficult issue to explain but here goes...
I have one query that I am using in a report...I need to open the query,
print to the report, resort the query and reopen it, and then add it to the
previous report...kind of like appending to it...is there anyway to do
that...

The way I have it going now is:

qryASR.SetOrderBy('avg_price');
qryASR.Open;
reportASR.Print;
qryASR.Close;
qryASR.SetOrderBy('person_name');
qryASR.Open;
reportASR.Print;

The above just opens the print preview form twice...I need it to be in the
same print preview...
Please help!

--Brandie


--
******************************************
Brandie VanNort
Computer Services Administrator
Ebby Halliday, Realtors
Dallas, Texas
http://www.ebbyhalliday.com
Phil 4:13 "I can do all things through
Christ who strengthens me"
******************************************

Comments

  • edited March 2005

    Options:

    1. Use Two queries

    Create a main report with no datapipeline. Remove the header/footer and and
    place two section style subreports in the detail. Connect each to a
    different query. You have each subreport load the same report layout.

    main
    section1 - query 1
    section2 - query2

    2. Print to archive and merge the archive files, then preview

    You can programmatically print the same report to two archive files (.raf).
    There is an archive merge utility available for download from our web site.
    Use that to merge the two .raf files. Then display the preview to the user.

    generate first report ---> myFirsReport.raf
    generate second report ---> mySecondReport.raf

    merge reports ---> myCombinedReport.raf ---> preview

    You can download the archive utility from the Download | Companion Products
    | RCL section of our web site. Look for the entry for kyRAFMerge twoards the
    bottom

    http://www.digital-metaphors.com/Subpages/Downloads/CompanionRCL.html



    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2005
    The first option won't work because there could be more than two reports
    that need to be combined...its in a for loop...
    I tried the second option, tried to compile the KURafMerge component and
    when I clicked on Compile, it says missing VCL50...I'm using Delphi 7, which
    I should have mentioned before...and the KURafMerge says it was made in
    Delphi 5...could that be the problem? If so, are there any other options?

    --Brandie


    --
    ******************************************
    Brandie VanNort
    Computer Services Administrator
    Ebby Halliday, Realtors
    Dallas, Texas
    http://www.ebbyhalliday.com
    Phil 4:13 "I can do all things through
    Christ who strengthens me"
    ******************************************

  • edited March 2005

    1. If you have a For loop then you will need to dynamically create the
    report and sections and associated data access components. Still very
    doable.

    2. To compile the kuRafMerger.dpk for D7, try7 updating the Requires clause
    from VCL50 to VCL70.


    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2005
    Thanks Nard...I've got it merging now...but I can't get it to preview once I
    have merged them...

    In my For Loop I have this:
    reportASR.ArchiveFileName := Application.GetNamePath +
    'reportAssocRanking' + inttostr(i) + '.raf';
    reportASR.Print;
    RAFMerge.SourceFiles.Add(reportASR.ArchiveFileName);

    And then after the for loop, I have:
    RAFMerge.DestinationFile := Application.GetNamePath +
    'reportAssocRanking.raf';
    RAFMerge.Execute;

    Any ideas?

    --
    ******************************************
    Brandie VanNort
    Computer Services Administrator
    Ebby Halliday, Realtors
    Dallas, Texas
    http://www.ebbyhalliday.com
    Phil 4:13 "I can do all things through
    Christ who strengthens me"
    ******************************************

  • edited March 2005

    I think what that code should give you is a 'reportAssocRanking.raf'.

    You then need to use the ReportBuilder ArchiveReader component to
    preview/print the .raf

    myArchiveReader.ArchiveFileName := Application.GetNamePath +
    'reportAssocRanking.raf';
    myArchiveReader.Print;


    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

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