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

OnGetFileSuffix event on TppGroup

edited April 2011 in Devices
Hi,

I'm just playing with creating PDF's out of report builder, specifically
creating a new custom named PDF at each report group break. I can't find how
to assign the OnGetFileSuffix event handler to a ppGroup using the designer,
is there a way to do this? I think I can do it via code but it's not exactly
easy to decide which TppGroup belongs to which report when you have more
than one report on a form.

TIA

Willie

Comments

  • edited April 2011
    Hi Willie,

    If possible, please change your posting name from "ReportBuilder" to
    your real name.

    Which version of ReportBuilder are you using? For the latest version
    (12.04), you can access the group objects themselves using the Report
    Tree and from the object tree in the Code tab. This way you have access
    to the Group properties and events directly from the report.


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    Sorry Nico, I didn't spot the posting name until after I sent the post.

    I'm using 11.08 at the moment. Looks like I may have to go to 12.04 then ,
    thanks for that.

    Another question though if I may, how would you recommend I catch exceptions
    for creation of the individual PDFs when using the Group break.?

    I wish to create an audit record in a database table for each PDF created,
    if something happens (e.g. I run out of disk space for the PDF creation or
    maybe there's an issue with my file naming convention) I'd like to be able
    to flag the audit record for the affected reports (i.e. the ones that raised
    an exception) as errored.

    Thanks.

  • edited April 2011
    Hi Willie,

    You will want to place a try-except around the Report.Print call. The
    issue here is to determine which group you are exporting when an
    exception is given. I would suggest using one of the group events to
    define a class variable that keeps track of the current group. This way
    during an exception, you will know which group had an error.


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    Thanks Nico,


  • edited April 2011
    Another question please,

    on RBWiki it says....

    If you would like to take complete control over the entire file name for
    each exported file, set the TextFileName of the report equal to a single
    underscore "_". This will then use the aText parameter as the entire file
    name.


    ....I've tried this and I'm finding that ReportBuilder is always adding a
    ".PDF" extension to whatever I've set the file name to be via the
    OnGetFileSuffix event. Is this a bug with my version (11.8) or does "the
    entire file name" only refer to the first part of the file name and not the
    extension?

    TIA

    Willie


  • edited April 2011
    Hi Willie,

    If no file extension is defined, the default one is added to generate a
    valid file. Looking at the code, if an extension is defined, then the
    default one is not added.


    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.