How to hide a data band when the running total of that band is zero

I have a report that shows a list of debtors with invoices sent to them and amounts paid.


For each debtor I show the amounts of all invoices and the amounts paid


GroupHeader: 'Debtor X'

Data

Invoice 1: $100

Payment: $100

GroupFooter : total: 0


GroupHeader: 'Debtor y'

Data

Invoice 1: $200

Payment: $500

GroupFooter : total: 150


Whenever the total equals '0' then I want to hide the entire block for that Debtor. So in the above case I want Debtor X to be hidden and Debtor Y to show.

My problem is that when the running Total is calculated I can no longer hide the current block

Is there a solution for this issue?

Comments

  • It depends on the structure of your report. The most universal solution is to check the necessary data in the AfterData event for GroupHeader and change its Visible property to False.

  • It's easier to deal with sql, depending on your structure. In the where condition put: where (Invoice <> Payment or Invoice <> 0). So the select will return only debtors.

  • Hello!

    Set `report.DoublePass = true`.

    On the first pass (Engine.FirstPass == true), calculate the group total (using Total / a dictionary with the group key: Dictionary<string, decimal>), and on the second pass (Engine.FinalPass == true), in the band’s BeforePrint event, check the saved total and set GroupHeader1.Visible = (groupTotal != 0) (do the same for the child DataBand / GroupFooter).

This discussion has been closed.