locked
hide group if records from a column are the same RRS feed

  • Question

  • Hi

    Is there any way to hide the entire group if records in a certain column are the same? for example here I want to hide the group BMW when the color of cars in this group are all black.

    Brand       Color          
    BMW        Black       -
                   Black        | <--hide this group
                   Black       -
    Infiniti      Red 
                   Black 
                   White  

    Thanks !

    • Moved by Alex Feng (SQL) Sunday, March 20, 2011 8:59 AM move to an appropriate forum (From:SQL Server Security)
    Wednesday, March 16, 2011 6:41 PM

Answers

  • Hi eva_1035,

    Thanks for your detail sample data for your report's requirement, I get your meaning completely. In Reporting Services we could add a filter to your group to filter the records which meet your condition(hide the group BMW when the color of cars in this group are all black). You could refer to below steps:

    1. Right-click the Row group Brand in the row group panel, and then select Group Properties...

    2. Move to Filters tab, click Add button.

    3. Type in =CountDistinct(Fields!Color.Value, "GroupName") for expression. Note: GroupName is your row group name.

    4. For operator, please Select >

    5. For value, please type in =Cint(1)

    After these steps, I think you could get your report's layout. If you have any question about the steps, please feel free to let me know.

    Thanks,
    Challen Fu

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by eva_1035 Wednesday, March 23, 2011 1:24 PM
    Tuesday, March 22, 2011 11:59 AM

All replies

  • Are  you talking about T-SQL solution or SSRS report? Always state what version you are using
    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    Thursday, March 17, 2011 7:44 AM
  • Thanks for reply. It's SSRS 2008 !
    Thursday, March 17, 2011 11:59 AM
  • Hi eva_1035,

    Thanks for your detail sample data for your report's requirement, I get your meaning completely. In Reporting Services we could add a filter to your group to filter the records which meet your condition(hide the group BMW when the color of cars in this group are all black). You could refer to below steps:

    1. Right-click the Row group Brand in the row group panel, and then select Group Properties...

    2. Move to Filters tab, click Add button.

    3. Type in =CountDistinct(Fields!Color.Value, "GroupName") for expression. Note: GroupName is your row group name.

    4. For operator, please Select >

    5. For value, please type in =Cint(1)

    After these steps, I think you could get your report's layout. If you have any question about the steps, please feel free to let me know.

    Thanks,
    Challen Fu

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by eva_1035 Wednesday, March 23, 2011 1:24 PM
    Tuesday, March 22, 2011 11:59 AM
  • Works! It's really helpful. Thank you.
    Wednesday, March 23, 2011 1:24 PM