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

Cancel a report

edited November 2004 in General
Hi,

I need to Cancel a report when a condition retated to subdetail pipeline is
True.
I try to do "Report.Cancel" in Subreport.DetailBeforePrint event, but then
the report never ends. Otherwise, I want to Cancel the main report, not only
the subreport.

I'm working with Delphi6 and ReportBuilder Enterprise 6.03.

Thanks in advance,

LADRILLO

Comments

  • edited November 2004
    Hi,

    I'm confused what you would like to happen. Would you like the Report to
    simply stop generating or would you like the preview form to close when this
    condition occurs? Simply calling Report.Cancel will not immediately cancel
    the report generation. You will have to wait until the report engine has
    finished its immediate task before the report will stop. I would suggest
    calling Report.PreviewForm.Close.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2004
    Hi,

    I want the report to stop generating (if is posible) and I want the preview
    to appear blank, without any data.
    I dont want to close the window, because I'm working fron Designer in an
    end-user reporting solution.
    I'm using RAP.

    If I call "Report.Cancel" on GlobalOnCreate event it works fine.
    The problem is when the condition to cancel is related to subdetail pipeline
    data. I don't know how to cancel the main Report after checking the
    subdetail data.
    If I call "Report.Cancel" on Subreport.DetailBeforePrint event, the report
    never ends and I think it only cancels the subreport, not the main Report.

    Thanks for all,

    LADRILLO

  • edited November 2004
    Hi Ladrillo,

    Unfortunately, I believe this is simply too late to cancel the report. Once
    the report engine has made it this far, it is going to finish regardless of
    calling Report.Cancel or not. As a test, try creating a global reference to
    the main report object in RAP. Then instead of calling Report.Cancel inside
    the subreport (which will only cancel the subreport), make a call to the
    global reference and call cancel on that.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2004
    Hi,

    I test your suggestion and the report stops generation (subreport doesn't
    prints), but the title and other previous subreports are printed.

    The report is checked two pass. So I think to test the condition on the
    first pass and to cancel the main report OnStartSecondPass of main report,
    but then I get an error:
    "Could not run program: ReportOnStartSecondPass".

    Also I think to browse the subdetail data pipeline linked to subreport in
    GlobalOnCreateEvent in order to test the condition and then cancel. I don't
    know if it is posible and I don't know how to do it.

    Can you help me?

    Thanks for all,

    LADRILLO



  • edited November 2004
    Hi Ladrillo,

    Sorry, unfortunately there are not any events in RAP that fire soon enough
    to allow you to successfully access the datapipeline. Specific events of
    this kind have been added for the next release of ReportBuilder.

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