How do I evaluate the toggle state of a textbox within an expression? RRS feed

  • Question




       On a Reporting Services 2005 report, I have a table with a single group row and a single detail row (and about 5 columns).  The details are set up to toggle visibility based on a textbox in the group header called "txt_Order_Number".  The order line item details are set with their initial visibility set as hidden.  So, when you click on the Plus sign next to the Order Number, the detail rows display below.


       However, what I'd like to do is change the background color of the toggled group header row when it is toggled and the details are displayed.  Here's what's going on . . .


       The row with the Order header information has every textbox set in bold.   That's good.  It makes a subtle distinction between the order detail rows and the order header row, so when you're looking at the dollar amounts on each line item and trying to add them up in your head to see whether they correctly add up to the dollar amount in the order header row, you can at least more easily see the total amount.  However, it makes the whole overall report look funny because all of the order header information is in bold.  What I really want to do is change the background color of the order header row to light gray or some other subtle color and change the font to Bold when the details are toggled to visible in order to distinguish that row as the header row.


       In order to do this, I think I somehow need to get to a certain element of the Reporting Services object model called "Textbox.ToggleState".  If I can get to that piece of the puzzle in an expression or even in code within the report, that should tell me the state of the textbox's toggle switch and I should be able to use that information to conditionally set the color of the textbox.(or every textbox in the row probably.)  Here's all I could find out about this on TechNet



    I just can't figure out how to get to that piece of information in a Reporting Services expression or in the report's code block. 


    Any suggestions?   I'd appreciate a response even if it's "You can't do that."  Actually, the best response someone might be able to provide might be a link to a sample showing how to get to any of the textbox properties like that.



    Thursday, April 10, 2008 8:38 PM

All replies

  • You can't do that.


    Once the report generated, it's impossible to dynamically change item properties.

    Thursday, April 10, 2008 9:15 PM
  • Hi Grégory


      Thanks for answering . . .


       How is this different from any other conditional formatting?  I'm sorry, but I really don't understand.  If I can change the color of text based on a condition or conditionally suppress a detail row, why can't I change the row background color based on the toggle state when the textbox is toggled?  If it's just not possible, then how is textbox.togglestate used?  Is is only used to set the initial toggle state programmatically? 


        I'm really confused.  Clearly, an event is fired when you toggle a textbox.  The screen gets refreshed.  I don't understand why I can't conditionally color a row based on the toggle state of a text box.  Please help me understand - or guide to a place that explains how that textbox property is used.





    Friday, April 11, 2008 3:36 AM
  • Okay . . .    I've done a bit more research, and it sounds as though at least up to about 9 months ago, the ToggleState wasn't exposed as a property you could test or check within an expression.


    There was lots of negative feedback about that.  Can anyone tell me if this has been resolved in RS 2008?  I about to begin testing, and it would be good to know if I'd be wasting my time trying this in 2008.  Please let me know.




    Friday, April 11, 2008 3:56 AM
  • Karen, did you ever find a way of doing this? I need to do the same thing with row colors.  I want to alternate colors and how I do that depends on whether a group of rows is visible or not.   I'm using 2008 R1.


    Saturday, December 5, 2009 3:34 PM
  • Karen, did you ever find a way of doing this? I need to do the same thing with row colors.  I want to alternate colors and how I do that depends on whether a group of rows is visible or not.   I'm using 2008 R1.




    Did you ever come up with a solution to this?
    Monday, January 4, 2010 5:09 PM
  • I have the same problem as Karen. Has anybody figured it out yet?
    Wednesday, June 30, 2010 12:23 PM
  • having same problem...
    Friday, August 6, 2010 2:37 PM
  • I need to do this too, is there really no way?
    Thursday, May 19, 2011 5:17 AM
  • Hard to believe we can't detect this at run time.... Yet another shortcoming of SSRS...
    Tuesday, June 14, 2011 9:43 PM
  • I too need this !! is there any work around at least ! :(
    Thursday, July 7, 2011 9:58 PM
  • Found out how to do this! Use the 'inscope' function.

    inscope("groupname") evaluates to TRUE if the group is toggled to expanded and FALSE if it is collapsed.

    So for a matrix with three levels of drilldown set the background colour to:

    =IIF(inscope("matrix_group3"),"Lvl3_colour",IIF(inscope("matrix_group2"), "lvl2_colour","lvl1_colour"))

    This is in SSRS 2005 but should work for 2008 as well. One drawback I noted is that the transition when you expand a drilldown isn't as smooth - I guess because it has to re-render the row.

    • Proposed as answer by dirk.wegener Tuesday, January 3, 2012 2:10 PM
    Tuesday, July 26, 2011 9:23 AM
  • If it's just for the purpose of alternate coloring the rows, perhaps you can look into this,
    Wednesday, June 27, 2012 11:18 AM
  • This is still solving issues in 2012! Excellent solution.
    Thursday, March 27, 2014 4:48 PM
  • Apparently this does not work anymore in 2014. Inscope evaluates to true if a field is part of the group and false if it's not. Toggling seems to have no effect. Any other solutions?
    Thursday, December 1, 2016 10:22 AM