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

How to test for an empty detail band

edited March 2012 in General
Hi,

for some reason I had some prints with empty detail-bands. Since this
must never happen, the user should be informed and an error-message
should be raised.
Which is the best way to check for an empty detail-band after printing?

I found OnNoData, but that seems to refer to the master-record as well.

thanks and regards Uli

Comments

  • edited March 2012
    Hi Uli,

    When you say "empty" detailband, do you mean that it contains no report
    components or that there is no data being printed?

    For the former you could use a report object loop to check if there are
    components present inside a band.

    For the latter, you could simply check the proper field values before
    the band prints and determine whether the band will display anything or not.



    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2012
    Nico,


    That's what I meant.
    As I mentioned, there were some reports with blank detail bands printed.
    Normally the database should *always* contain data.
    The question is: is it possible that rb doesn't print a detail band
    though there are data in the detail-table without raising an error?

    In either case I would like to display a warning message.

    Thank you. Regards Uli
  • edited March 2012
    Hi Uli,

    You could use the DetailBand.BeforePrint or BeforeGenerate event to
    check the appropriate fields. If they are empty, you could display a
    message, or hide all components inside the detail band so it does not
    display.

    Best Regards,

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