ImGoingToSqlBits150

My Twitter

twitstamp.com

Custom Visibility Toggling in SSRS

I can see clearly now

The visibility property of Report items can be a little gem. You can set the initial visibility of an item to hidden/visible , use another report item (a parent group in a table or matrix) and set the initial appearance of the toggle icon (+/-) either absolutely or using expressions. By using expressions, you can dynamically determine whether or not the item should be hidden (or collapsed in the case of a table/matrix grouping), and subsequently set the initial appearance of the icon.

In the example below, textbox8 is my toggle item for the group “Priority“. When the report loads I want to show the “critical” items in an expanded state, and all other priorities in a collapsed state. By right-clicking ontextbox8 and choosing properties I get the window below. Select Expression for the Initial appearance of the icon and enter a formula that will determine whether the initial appearance of the icon is expanded (’true‘) or collapsed (’false‘). What you use in your expression to evaluate whether or not the toggle item is expanded or collapsed is up to you.

Note. The above assumes that the Group “Priority” has already had it’s visibility set using an appropriate expression to show the “Critical” items expanded and all other collapsed when the report is run. It also assumes that the visibility of the group “Priority” is toggled by another item (textbox8).

Fig 1. Text Box Property dialog, showing the Visibility Tab

Fig 1. Text Box Property dialog, showing the Visibility Tab

The result is shown in Fig 2.

Fig 2. Result of setting custom visibility for a table group
Fig 2. Result of setting custom visibility for a table group
-luke
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • email
  • FriendFeed
  • LinkedIn
  • NewsVine
  • Reddit
  • Twitter

13 comments to Custom Visibility Toggling in SSRS

  • Mona

    Hi Luke,

    I would like to have a color change after clicking on a hyperlink in the master report, so you know that you have already clicked that item to see the detail report.
    any idea would be appriciated.

    Thanks,
    Mona

    • Luke Hayler

      Hi Mona,

      That’s a great question. I’m afraid that I don’t the answer off-hand. I expect that you could place some custom code (an OnClick Event?) to the report and then reference that code in the colour expression of your links. But I’d be guessing.

      Your best bet is to log this question with the folks over at StackOverflow, if you haven’t already. It’s a great resource.

      I’ll dig a little in the menatime and see what I can find out.

      Luke

  • mahesh

    Hi ,

    I a m designing a ssrs 2005 report.
    Problem is : I have a field in group header and if its vale =22 then I would display my report data else I should dispaly “Cannot be processed”

    Please help me out
    Mahesh

    • Luke Hayler

      Hi Mahesh,

      I’m afraid you’ll have to expand on what exactly you’re after. It is not clear if the group header is part of a table or a matrix object. Secondly, if the specified group header <>22 then do you want to display the object (table/matrix) with “Cannot be displayed” in the data cells, or do you want to hide the object completely?

      If you can be more specific I am sure that I’ll be able to help you out.

      -Luke

  • Thomas

    Hello,

    thank you very much for your explanation. I was a little bit confused, because I’ve not that field at the visibility tab for the specified textbox. But I found the solution.

    Click the textbox where the toggle-item is shown and open the “Properties”-Box for the textbox.
    There you find an entry called “InitialToggleState” which you can set to “true”,”false” or an expression. Thats it. *THUMBS UP*

    Have fun.

    Greetings from germany.

    Thomas

  • Akshar

    Hi i got a requirement on this, can any one try this out
    i am using a tablix(ssrs 2008) in which i am setting the toggling property (row visibility) for the second row based on a field in the first cell in the first row.
    its all working good, but now i need to hide the “+” sign when there are no records to be shown. is this possible

  • Thanks for the write up. Question, I’m using SSRS 2008 and want to defaul my matrix to open or (Expanded) upon initial startup. Any thoughts on how to do this in 2008

  • [...] while back I wrote a post about how to toggle the visibility of rows/columns in tables/matrices for SSRS 2005. In the comments of that article someone asked how this was done in SSRS 2008. The short answer was [...]

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>