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

Setting Detail Band Visible after calculation

edited February 2006 in RAP
Hi,

I would like to be able to set the detail bands visible property after it
has performed all of its calculations. Here is the situation:

I am displaying customer information but I would only like to display
customers that do not have a zero balance. The problem is that I do not
know the balance when I start processing the report.

The detail band has several subreports that need to be processed in order to
determine what the balance is. Then once the subreports have been processed
set the Detail band to invisible if the balance is zero.

The ideal way to do this would be to use a two pass report and store what
the balance is after the first pass. Then set the detail band to invisible
on the BeforePrint of the second pass. The problem is that this seems to
cause problems with ReportBuilder in knowing how many pages it is printing.

Is there any way around this issue.

Thanks,
Richard Gostin

Comments

  • edited February 2006
    Richard,

    How about adding a group based off your customer number with the group
    footer being what displays your customer information. This way, you can do
    your calculations the detail band and then use the GroupFooterBeforePrint
    event to determine the visibility of the customer information.

    --

    Bob

  • edited February 2006
    Hi Bob,

    Am I right in assuming that there is no way to perform the calculation and
    then display the results in the same band. What I am trying to avoid is
    doing the calculations twice. Once to determine if I need to display the
    information and then once when I print the band. It seems that because the
    band is printed as it is being calculated there is no way to do the
    calculation first then do the printing.

    Thanks,
    Rich

  • edited February 2006

    Pagination is determined during the first pass, therefore a two pass report
    will not provide a solution.

    One option might be create a summary query that performs the calcs using SQL

    Another option is to pre-process the data and store the results in a temp
    dataset. Performing more of the data processing work up front will simplify
    the report. (Although I realize that this might not be your first choice).





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2006
    Rich,

    You could use the band's before print event rather than the variable's on
    calc event IF the value was determined in the main report. The value could
    then just be assigned using the on calc. Because your value is coming from
    sub-reports and these fire based on the detail band, I do not think that you
    have this option.

    This should not be a problem that requires the calculation being performed
    twice. Save the value to a global variable in the sub-report and then use
    the global as your condition check for group footer visibility.

    --

    Bob

This discussion has been closed.