Conditionally Hiding Bands

media_1254891182386.png

In this example, we will hide the Group Header and Detail bands, if a grouping field meets a certain condition. Note that no scripts are required to accomplish this task.

Add a Group Header band to the report.
For this, right-click anywhere over the report’s surface, and in the invoked Context Menu, point to Insert Band and click GroupHeader.

media_1254891199182.png

Drop a field which will be used as a grouping criteria, from the Field List onto the created GroupHeader1 band.

media_1449121385538.png

Select the Group Header, and click its Smart Tag.

Then, in the invoked actions list, click the ellipsis button for the Formatting Rules option.

In the invoked Formatting Rules Editor, click the Edit Rule Sheet… button.

media_1449121471974.png

Now, in the invoked Formatting Rule Sheet Editor, click the button, to create a new rule.

Then, set its Visible property to No, and click the ellipsis button for the Condition property.

media_1254891297455.png

Now, select the Group Header band’s strip, and in the Property Grid, locate the Formatting Rules property, and click its ellipsis button.

In the invoked Formatting Rules Editor, click the Edit Rule Sheet… button.

media_1449121510564.png

Construct the required logical expression (e.g. [CategoryID] < 2), and click OK.

media_1254891553528.png

Back in the Formatting Rules Editor, move the created rule to the dialog’s right section (Applied Rules), to make it active.

And, do the same for the report’s Detail band. That is, click the ellipsis button for its Formatting Rules property, and in the invoked dialog, apply the same rule to this band, as well.

media_1449121606579.png

Switch to the Preview Tab, and view the result