SSRS 2008 Report toggling between images for various field values

reportingssrs-2008

What is the best way for toggling between images on a SSRS report?

On the report I'm creating, there are lots of questions with Yes Or No answers and based on the value I've got for the question, I'd like to show the correct image.

For example we have gender:

Famale
Male

This report is for output only and is not going to be used for performing data entry.

For each record I have the value in the column 'Gender' whether the person is male or female. I want to show a square with a tick mark in it next to the correct gender, while keeping the other option box empty (an empty square image). This should function like a radio button.

So if the record has gender = 'Female', I should show a tick image next to Female text box and an empty square next to Male text box and, vice-versa, if gender = 'Male' on the record.

Any suggestions?

Best Answer

You can use expressions for this type of conditional work. To do this click on the image and select the properties tab in BIDS. Find the expression button (fx) and click it. Enter something like the below to get what you want:

=Iif(Fields!Gender.Value = "Female", "Female.jpg", "Male.jpg")

This is assuming that you have have set up the images to be available as global resources to your report. If not, replace the image names with the paths to the images etc...

A good reference for expressions is below:

http://msdn.microsoft.com/en-us/library/ms157328.aspx

I hope this helps you.