Use Sub-bands to Show a Report Band Conditionally
This topic describes how to use sub-bands to display different content based on a specific condition.
The report created in this tutorial contains two sub-bands of the DetailBand with different sets of report controls. One sub-band displays data when the customer’s Contact Title
is `Owner’; another sub-band displays data for other cases.
Do the following to create a report with conditionally visible sub-bands:
Use the Report Wizard to create a Table report bound to the
Customers
table of the Sample Northwind SQLite Database (nwind.db).Add two sub-bands to the Detail band:
Copy the data-bound table to the sub-bands. Delete the cells bound to the
Address
,City
,Region
, andCountry
fields from SubBand2. Delete the data-bound table from the Detail band:Select SubBand1 and click the
f
button to invoke the Expression Editor. Specify the following expression for theVisible
property:[ContactTitle] == 'Owner'
Select SubBand2 and click the
f
button to invoke the Expression Editor. Specify the following expression for theVisible
property:[ContactTitle] != 'Owner'
Switch to the Preview window and observe the result: