• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 743
  • Last Modified:

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

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?
3 Solutions
x-menIT super heroCommented:
make each image a "subreport" that is trigered by the properties of the group
ValentinoVBI ConsultantCommented:
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.
canuckconsultingAuthor Commented:
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.
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

canuckconsultingAuthor Commented:
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.
ValentinoV  does have half of the code right ....

=IIF(Trim(Fields!MyTablixFieldName.Value), IIF(Trim(Fields!IsFirstClass.Value), False, True),False)
canuckconsultingAuthor Commented:
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now