SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSRS: Display Alternative Image in a Report


SSRS: Display Alternative Image in a Report

Author
Message
andykr-773587
andykr-773587
SSC Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 Visits: 276
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
abhijeetv
abhijeetv
Right there with Babe
Right there with Babe (753 reputation)Right there with Babe (753 reputation)Right there with Babe (753 reputation)Right there with Babe (753 reputation)Right there with Babe (753 reputation)Right there with Babe (753 reputation)Right there with Babe (753 reputation)Right there with Babe (753 reputation)

Group: General Forum Members
Points: 753 Visits: 510
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.
andykr-773587
andykr-773587
SSC Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 Visits: 276
Thanks, I hadn't thought of that one.

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

----
Regards
Andy Kramek
Mark Eytcheson
Mark Eytcheson
Mr or Mrs. 500
Mr or Mrs. 500 (545 reputation)Mr or Mrs. 500 (545 reputation)Mr or Mrs. 500 (545 reputation)Mr or Mrs. 500 (545 reputation)Mr or Mrs. 500 (545 reputation)Mr or Mrs. 500 (545 reputation)Mr or Mrs. 500 (545 reputation)Mr or Mrs. 500 (545 reputation)

Group: General Forum Members
Points: 545 Visits: 8672
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")
andykr-773587
andykr-773587
SSC Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 Visits: 276
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
wkelton
wkelton
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 15
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
mohedm
mohedm
Grasshopper
Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)

Group: General Forum Members
Points: 22 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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search