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

Newbie question - passing data from Dehlpi to Report

edited November 2011 in General
Hi all,

I have a ADOConnection, ADOTable, DataSet and ppDBPipeline all connected
together and working perfectly. I use ADOTable.Filter / Filtered properties
to filter the data shown within report. I also use a handful of different
reports which use the same Dataset but with different degrees of detail.

Each report is called like...

PrepareFilters;
Report := TppReport.Create(Form1);
Report.PreviewFormSettings.WindowState := wsMaximized;
Report.DataPipeline := ppDBPipeline1;
Report.Template.FileName := ExtractFilePath(Application.ExeName) +
'\Reports\Reportname.rtm';
Report.Template.LoadFromFile;
Report.PrintReport;
Report.Free;

This all works perfectly and as expected.

What I'd like to do is have Label / Variable / Parameter on the report whos
value is set at Runtime. My aim is to have a description what the ADOTable
is being filter on and print that on the report. I'm sure this must be
possible, but having spent a reasonable amount of time on Google /
Newsgroups / rbWiki I can't find the answer.

Any help will be gratefully received.

FYI I'm using Delphi 2010 with a Demo of ReportBuilder Standard 12.05, with
the intention of purchasing in the next couple of weeks..

Also, I've I'm not doing this the most effective way, I'm happy to hear an
alterative.

Kind regards

Steve Scotter

Comments

  • edited November 2011
    Hi Steve,

    Thanks for your interest in ReportBuilder!

    With your current implementation, I would suggest adding a label to each
    report that is meant to be altered by the outside world. Then after you
    load the template, you could loop through each report component, find
    the label and assign it the value needed. See the following article on
    how to loop through every report component.

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/Report_Object_Loop

    If the above seems a bit cumbersome, the ideal way to design this type
    of system would be to use the Enterprise edition of ReportBuilder and
    move all your data access and event code out of Delphi and inside the
    report template itself. Using the Data Workspace or (DADE) you can
    create and access all your ADO datasets inside the report. From there
    you can filter the data yourself or give your users the ability to
    search themselves using the AutoSearch feature. In either case you can
    access the search values using the Code Workspace or (RAP) and display
    them on the report in a similar manner but keeping all the event code
    local to the template itself. This way your code in Delphi is very
    simple and the form is virtually empty save the report object.

    If you choose to pursue this option, I suggest spending some time with
    the DADE and RAP tutorials located in the Developer's Guide. These give
    a great starting point for understanding a utilizing these powerful
    features.

    Best Regards,

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