Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSRS: Display Alternative Image in a Report Expand / Collapse
Author
Message
Posted Sunday, October 5, 2008 7:32 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 11, 2014 8:03 AM
Points: 36, Visits: 229
Hi All,

I have a requirement to produce a report that uses a 'traffic light' display and cannot seem to find any way to do it - other than having separate three columns at the beginning of each row.

Here is the scenario:

I have a report that uses a table to display Header/Detail lines (collapsible). Each detail row has a "status" that is calculated on the fly by a stored procedure based on various criteria. The status is a simple integer value (i.e. 1, 2 or 3). I have three jpg files (a red, ayellow and a green traffic light) and I want to display the appropriate image on each row based on the status value so that:
If 1 => Red
Else If 2 => Yellow
Else If 3 => Green

In other reporting tools I would do this by overlaying the images in the first column of the report and setting the Visible expression for each so that only one is actually displayed. However it seems that SSRS doesn't support this - trying to add a second image to the column deletes the first!

Is there any way to do this ?


----
Regards
Andy Kramek
Post #580852
Posted Monday, October 6, 2008 5:16 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, May 25, 2012 8:08 AM
Points: 496, Visits: 508
If I understood right, I have done similar thing in the past where I was showing different image in the column depending upon another column value in the same row.
To do this:
Add a column that has this image and in the Properties > Data > Value > Expression, depending upon your condition (i.e. if 1 then Pick up Red image, if 2 then Yellow and if 3 then Green) attach the appropriate image.
This will display the correct image depending upon the condition per row.
Post #581005
Posted Monday, October 6, 2008 5:25 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 11, 2014 8:03 AM
Points: 36, Visits: 229
Thanks, I hadn't thought of that one.

I will try it out and let you know how I get on.


----
Regards
Andy Kramek
Post #581009
Posted Monday, October 6, 2008 8:19 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, August 18, 2014 4:26 PM
Points: 377, Visits: 8,634
When developing SSRS Reports that link stoplights to values from projects within MS Project Server, I use this expression to display either a green, yellow, or red stoplight for the project task in the Report. This expression is placed in the Data -> Value field for an image embedded in the report. The values in double quotes are the names of images for the different stoplights which I've embedded in the report.

=Switch(Fields!TASK_PCT_COMP.Value=100,"greenstoplight",((Fields!TASK_PCT_COMP.Value (DateDiff("d",Fields!TASK_START_DATE.Value,Fields!TASK_FINISH_DATE.Value)*0.1),"redstoplight")
Post #581103
Posted Thursday, October 9, 2008 3:45 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 11, 2014 8:03 AM
Points: 36, Visits: 229
Thanks. Actually a simple IIF expression worked just fine in this case (only two options anyway) once I added the jpg to the project:

=IIF( Fields!ismain_flg.Value = False, "tlred.jpg", "tlgrn.jpg")

But I will certainly try this one on my more complex reports. Much appreciated.



----
Regards
Andy Kramek
Post #583162
Posted Thursday, March 10, 2011 2:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 25, 2013 4:33 AM
Points: 1, Visits: 9
HI All,
I've been fighting the same thing. I've built an IIF statement like this one. But when i print all I get on the report is a small red box like the image has been suppressed.
Thanks
Wayne
Post #1076582
Posted Saturday, December 3, 2011 6:13 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, July 3, 2013 12:49 AM
Points: 12, Visits: 12
If you are using SSRS 2008 you can use indicators. The link is for a video that demonstrates how to use them:

http://youtu.be/Krz120kooGc
Post #1215917
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse