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

Drill Down / Cloning question

edited February 2005 in General
Version 6.0.3

I went through demo 153 and it's raised several questions

1. Why is the spawned report a direct descendant of TppCommunicator. Why not
use a second TppReport at design time. I assume it has something to do with
TppReport being a heavyweight class but would like some more clarification.

2. I had a report that had numerous sub reports. After seeing demo 153 I
decided that the presentation shown there was much better. In trying to
implement it I've come across the following issue. When doing a report you
can create a group which allows the report to break. This is effect allows
you to give the illusion of multiple reports running. For example, a sales
report done by store where each store is on its own page. Rather than using
groups I'd like to programmatically spawn a new tppReport and add it to the
PageControl. The end result would be that each store is now on it's own tab.

The question is, how do I clone a report? I basically want to take a report
that's already designed and make multiple copies of it. I think I can do
this by saving it as a template and the reloading it, but I thought I'd ask
and see if there is a better way.

3. When a TppViewer is assigned to a report, it runs the report. Is there a
way to control that behavior?

4. If it hasn't been done already... As a suggestion, the demo needs to be
reworked using a PageControl rather than a TabbedNotebook. TabbedNotebook
has been deprecated.

Preston

Comments

  • edited February 2005
    Hi Preston,

    1. The name TmySpawnedReport is misleading because it is not a report at
    all. As you can see, it actually contains a TppReport and TppViewer object.
    I believe it was made to be a descendent of the TppCommunicator class in
    order to override the Notify method. This must have been an issue with an
    earlier version of RB as the overridden code has been commented out. The
    TmySpawnedReport class as more like a builder class creating, then placing
    the report, viewer, and data components together on the specific tab.

    2. This demo is meant to show a different way the drill-down feature could
    work in ReportBuilder which requires the use of a Master-Detail relationship
    in your data. It sounds like you are using a single dataset and creating
    groups based on a datafield in that dataset. You will need to now create
    two datasets... the master containing the grouped field, and the detail
    containing the rest of the data including the master linking field. For
    more information on Master-Detail reports, take a look at Demos 61 - 70 and
    see the data access articles in the Tech-Tips newsgroup.

    I'm a bit unclear about the reason you need to "clone" a report. Example
    153 simply displays subreports in a separate viewer for the user. If you
    were to actually clone a report, the method you describe below would work
    just fine.

    3. See the help topic for the TppViewer object. The TppViewer object
    contains all the necessary commands to load, and navigate a report.

    4. I apologize for this, Demo 153 has not been updated in many years. I
    will add this to our todo list for possible future enhancements.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2005
    Hi Nick,

    The information in the help file regarding the TppViewer did not answer my
    question. I probably wasn't very clear. As soon as I set the report property
    of the viewer opbject it runs the report. It doesn't seem to be calling
    print as I created a before print event and it never reached it. How do I
    stop the viewer from running the report when assigning the report property?

    I understand the master detail relationship, but I don't think any of the
    demos given cover what I would like to do. The report I'm writing shows
    Sales for the entire corporation, and then individually for each location.
    This woks fine using subreports and is what I originally was using. The
    problem is that it's not navigable. If you want to see the sales for store 2
    you have to go through the report one page at a time until you find store 2.
    For a 5 page report that's not a big deal, but in a 100 page report it is.

    Ideally I'd like to take demo 153 and have it work such that each group
    break appears on it's own tab. However, I don't think that's possible, which
    requires I rewrite each group break as an individaul report. To solve that I
    need to iterate through my dataset and create a new report, assign it to the
    tab, and provide it's data.

    I've already designed the report and don't want to have to do it
    programatically when I create the clones.

    Now maybe you've already provided the best answers reagarding this. It
    appeared you didn't understand what I was trying to do, so I explained it
    again in case a better method exists.

    Hope that helps.
    Preston

    BTW.. I think demo 153 is an excellent demo as it moves beyond just the
    report itself and into the viewer. My next step will be to get the page
    control to automatically add additional viewers based on screen size and the
    number of pages. In other words, if the screen is big enough and can fit N
    pages, then do so.



  • edited February 2005
    Hi Preston,

    When using a TppViewer, you are calling the PrintToDevices routine to print
    in which case you have to write the code to prepare the report. This is the
    reason the BeforePrint event is not firing. See the TppReport.Print method
    (ppReport.pas) and its ancestor TppProducer.Print (ppProd.pas).

    Have you taken a look at the AutoSearch feature in ReportBuilder? This
    would allow you to provide a simple dialog to the user in order to filter
    the data shown on your report. You could filter the master dataset making
    the issue of navigation nonexistant.

    Correct, in order to make you report act like demo 153, you will need to use
    subreports, or individual report objects.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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