Lets face it, we all have had our challenges with Reporting Services 2008. But recently I came across something that I would have thought should be really easy to do. And believe it or not, it is, but the problem is the IDE has a bug which hides the intuitive behavior for us.

Q. How do you show/hide an image in a table cell (textbox) based on some value in the database (or dataSet)? An eg. is a report based on stock prices. When a stock goes up, show the green arrow, stock goes down, show the red arrow.

A. There are few steps involved in accomplishing this. Step 1 is to draw the table ofcourse!. Step 2 is to throw 2 images (the images that you want to shift based on db values. Lets assume for the sake of this writing, we call them red_arrow and green_arrow. So, when the stock price change is in postive number, we want to show green arrow and when there is decline in stock price, we want to show a red arrow. So far so good. Now, in order to the rdl to know which two images that you are planning to use, drop 2 image controls from toolbox into the rdl and give them name as red_arrow and green_arrow. Also, make sure that you set the visible properties of these 2 images to hide.

Now, click on your table cell where you want these images to rotate, drop an image control there. Right click, go to Image properties and under 'Use this Image', you can actually use a function (FX). Click on Fx which should open up the selection window. Here is where the big gotchas/bug in Visual studio is. When you have a regular texbox, you have access to fields in dataset. But when you drop images, the fields in datasets are missing  (see image below).

In order to overcome this technical challenge, simply assume that you have access to field values there and hand-type your IIF syntax. Something like this.

=IIF(Fields!LTP_CHANGE.Value < 0, "red_arrow", "green_arrow")

You will see those red squiggly lines indicating a syntax error, but just ignore that for now.

Try and preview your report,it should show you correct images, based on your delta values. Thats it!