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

Method RequestPage in TppReport

edited June 2007 in General
Hello.

I want to make some code to print the pages of the report out-of-order
or to insert two pages of other report after one.

I mean I got three report (not the same rtm), and I must print the page
1 of the report 1, following of the page 1 of the report 2, etc... Also,
I cannot alter the report to put a subreport or such since the program
knows witch report to print only at the run time (it's dynamic).

So far, I was thinking about using TppReport.PrintPage, but It doesn't
work. I saw in the doc that PrintPage is replaced by RequestPage, but I
the parameters of the RequestPage doesn't seems adapted to my needs.

Can you put me on the right track to do this ?

Thanks.

JFPicard

Comments

  • edited June 2007
    Hi Jean-Francois,

    My suggestion would be to create a new main report containing a detail band
    and three section style subreports. First load each RTM file into each of
    the subreports respectively, then you can define which pages are printed in
    which order using the page list. The SpreadSheet style example does
    something very similar to this. Take a look at the example and see if you
    can use the same technique on your application.

    http://www.digital-metaphors.com/tips/SpreadSheetStyle.zip

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2007
    Hello Nico.

    Thanks for the tip. It's the same thing to do if the report is in the
    database ?

    Thanks.

    JFPicard

  • edited June 2007
    Nico, I've tried the demo, but when I use the Preview button, I have a
    blank report and if I uncheck 'collate' I have a 'Invalid pointer
    operation'.

    Can you verify the demo please ?

    Thanks

    JFPicard

  • edited June 2007

    Oops. I updated the example to work with the latest release of RB. Please
    download the example again and retest.


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited June 2007
    Thanks.

    Got another question. Can I add pages to a stand alone report or I must
    use subreports and 'reshuffle' the pages ? And does the report that will
    receive the pages with ReceivePage must be in cached mode ?

    Thanks.

  • edited June 2007
    Hi Jean-Francois,

    1. Using Subreports is an easy way to separate the pages. It is possible
    to create a TppPage object form scratch, add drawcommands to it and send it
    to the device however it is much easier to simply retrieve that page from a
    subreport inside the main report.

    2. Yes, the report must be in cached mode as it is essentially generating
    each page in memory then reshuffling them before they are sent to the
    device.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2007
    Thanks Nico.

    I will add subreport in a temporary report instead of doing x TppReport
    and add pages to another one.

    Can I add blank pages into a cached report and how can I do so ?

    Thanks.

  • edited June 2007
    You should be able to do so by simply adding an empty section subreport to
    your main report (perhaps as the last page). Although we have not tried it
    here, it may also be possible to create your own empty TppPage objects and
    send them to the device.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2007
    Thanks Nico.

    I will try to do so. By the way, adding subreport to my main report and
    loading it from the DB is fine.

    But if my reports has a subreport in it and I load it into my main
    report, the report goes into an infinite loop (endless pages) or give me
    blank pages. For example, I put three subreport into a blank report (in
    the detail band of the report) and I load my report into the subreport.

    Can you put me on a track to find the problem ?

    Thanks.


  • edited June 2007
    Hello Nico.

    I did some tests and if my subreport (inside my report that I load) as
    PrintBehavior := pbChild, then I go into an endless loop with that
    method, but it print fine if I load it normally. If I convert it to
    pbSection, all is fine, but I print the double of the pages (18 instead
    of 9). Is there anyway to specify a pbSection subreport to print on the
    same page as the main report ? Or is there something that I can do to
    print correctly with the pbChild ?

    Thanks.

  • edited June 2007
    Hi Jean-Francois,

    There are many reasons a report will try to print endless pages. The first
    thing to check is that the subreport template you are loading is actually
    connecting to the proper data. Second, be sure all bands and components are
    within the printable area of the main report. As a test, try creating a
    simple empty report with a subreport in the detail band and load one of the
    templates to see if the problem still occurs.

    Section subreports by definition will begin their own page before they
    generate and print. We will need to find the reason child subreports are
    causing endless pages to get the final report you are after.

    --
    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.