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

Printing in another printer throws exception

edited May 2009 in General
Hello,

I'm running into a really anoying issue with RB.
I'm pretty sure it must be my fault but would like to have your help in
order to find out exacly what is going on here.
Well, I have a report that does what follows

1 - Get the template from the DB
2 - Link the detail beforeGenerate to a local Delphi function, this function
2.1 - Manually constructs a ClientDataSet
2.2 - Links the detailBand to my local dataPipeline (wich is linked to
the clientDataSet mentioned above)
3 - print

It all runs ok, the report is shown in the screen.

If I try to print it to the default printer, it goes OK!

If I try to print it in another printer it throws an exception.
Investigating a little further I found out that the RB is trying to open my
ClientDataSet. It was created and constructed already so, why it is trying
to open again. I think it is related to the printer changing.


Any help?

Thanks

Comments

  • edited May 2009
    Ricardo,

    Which version of ReportBuilder and Delphi are you using? If you create a
    minimal example, (form, report, button) are you able to recreate this
    behavior?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2009
    Hi Ricardo,

    Re-reading your post, you do not want to set up your data access inside the
    DetailBand.BeforeGenerate event. This is much too late to do so and this
    event can fire multiple times. Perhaps try using a different event such as
    the OnInitializeParameters.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2009
    It's really complicated to isolate the issue right now. I'm preparing
    something isolated but, if you could answere me this I thing I can move
    toward the solution (or the isolation of the issue):

    When I print in some printer different than the report's default, does RB
    reopen my Pipelines?
    Because this is happening to me, I just don't know if I am causing this or
    if it is the default behaviour.

    Thanks and sorry for the messy informations I'm giving, it's because this
    code is really complex.

  • edited May 2009
    Hi Ricardo,

    Yes, if you change from the default printer after the report has already
    been previewed, the engine is re-initialized which in turn re-opens the
    pipelines connected to the report.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2009
    I thing my problem is in this point. Because when it renders the first time
    it only opens the pipelines linked to visible bands. The second time it
    tries to open every pipeline, it happend that given my logic some datasets
    are not populated. One of this datasets (TClientDataSet) has no provider and
    I populate it "by hand", but only when it's band is visible. Once RB is
    trying to open every pipeline it tries to open this CDS and a "no data
    provider" exception is thrown.

    Att.


  • edited May 2009
    During initialization, the report engine tries open and initializes every
    datapipeline associated with the report - including data-aware controls,
    child reports, etc.



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

    Best regards,

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