SSRS with per-page group - how to hide or show items based on displayed group

Posted on 2014-08-17
Last Modified: 2014-09-29
I have created a SSRS report which is to be a mail label.  The dataset is a list of addresses to print and I have created a group on the addresses with a new page after each group.  The report looks like the following:

The Expression shown is the address which is working fine.  The problem is I need to change the visibility of the images to the right based on properties of that group.  For example, the dataset has the field IsFirstClass which, if true, means the 2nd class image should be shown.  There is also a field HideCustomsForm which if true means the Customs declaration form should be hidden.

How can I have the visibility property of these images refer to fields in the currently displayed group?
Question by:canuckconsulting
    LVL 18

    Accepted Solution

    make each image a "subreport" that is trigered by the properties of the group
    LVL 37

    Assisted Solution

    The Image object has got a property called Hidden.  Assuming the Image object is located inside a tablix which is connected to your dataset, you could use an expression like:

    =IIF(Fields!IsFirstClass.Value, False, True)

    Open in new window

    This expression would show the image when IsFirstClass is set to True, otherwise it will be hidden.

    Author Comment

    X-Men: I can see this is the way forward but am struggling to work out how to get the positioning right.  Would I create a tablix of one row, expand that to my label size and then place subreports within this?  It doesn't seem right that (and I'm not sure if possible) but I can work out how else to have the subreports refer to the current record/group.

    Author Comment

    ValentinoV - Thanks for the feedback but the issue I'm having is having that the visibility based on a data field active in a tablix on the same page.
    LVL 27

    Assisted Solution

    ValentinoV  does have half of the code right ....

    =IIF(Trim(Fields!MyTablixFieldName.Value), IIF(Trim(Fields!IsFirstClass.Value), False, True),False)

    Author Closing Comment

    In the end I created a report with a single subreport sized to fit a quarter of the report size.  Within this subreport I used the code above to show/hide the relevant images.

    Thanks for your help.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now