SSRS: Display Alternative Image in a Report

  • 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

  • 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.

  • Thanks, I hadn't thought of that one.

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

    ----
    Regards
    Andy Kramek

  • 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")

  • 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

  • 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

  • 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

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply