SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 
        
Home       Members    Calendar    Who's On



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

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 29, 2009 6:07 AM
Points: 13, Visits: 56
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 06, 2008 5:16 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, June 14, 2009 11:52 PM
Points: 357, Visits: 432
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 06, 2008 5:25 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 29, 2009 6:07 AM
Points: 13, Visits: 56
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 06, 2008 8:19 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, July 02, 2009 7:15 AM
Points: 273, Visits: 568
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 09, 2008 3:45 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 29, 2009 6:07 AM
Points: 13, Visits: 56
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
« Prev Topic | Next Topic »


Permissions Expand / Collapse