Conditionally show the expand/collapse button (+/-) dependent on an expression

I’m working on a report where some of the rows have drilldowns and some do not. The boss wanted only the rows with drilldowns to have the expander next to them. I didn’t think it was possible but he was able to guide me in the right direction, so here is how it is done.

Normally, you would have your group or details’ visibility toggled by another report item (a textbox in almost all cases). The textbox is whatever item you want the expander to appear next to. There is no built-in expression to toggle the visibility of the expander itself, so to conditionally hide or show the expander:

  1. Add an empty column to the left of where the expander would normally appear. Size it down so it’s not too big (too small and the expander won’t appear at all). This column is not bound to any data so it will be blank all the time.
  2. Right click your detail group you want hidden or shown and click Properties. Click the Visibility tab. Change the textbox so it’s the new blank column instead of the one to the right of it. Click OK to close the dialog.
  3. Run the report so you can be sure the expander appears. If the field is sized too thin, the expander won’t appear, so be sure you do this before the next step.
  4. Right click the empty cell where the expander is shown and click Properties. Click the Visibility tab. Under Initial Visibility, select Expression and enter the expression to use to hide or show that expander (+/-) control.

Now, the expander control itself is controlled by that expression you entered in step 4. Super easy to do and nice outside-the-box thinking to make it work. Thanks boss!