How many times have you wanted to make your System Center Configuration Manager (SCCM) SSRS reports quickly convey a small piece of information? Adding a dynamic image might be exactly what’s needed.
In a new report that I created, I decided to use dynamic images to show folks the online status of a list of computers. How can you add a dynamic image to a report table? Believe me when I say that it’s as easy as adding a static image to a table. I was surprised to learn that I haven’t written a blog post on this topic yet, so in this post I will show you step-by-step how to add a dynamic image to a column in a table or a matrix.
In order to convey the online status of a computer in my new report, I will show you how I added a small column which houses the image. The image will be three dots: green for online status, grey for offline status and black for unknown status. Which image is displayed all depends on the results of my SCCM query. This query is based on the online status of a computer, which if I remember right, was added into SCCM current branch 1602. I’ll also show you the IIF statements I used that define what dynamic image is displayed.
Can You Add a Dynamic Image to a Column Table in Report Builder?
ABSOLUTELY! However, due to the limitations of Report Builder, I almost never use it. Instead, I will use Visual Studio BI, but these instructions are almost 100% identical to what you would do in Report Builder.
First, you must have:
-SQL Server Data Tools 2015 or later installed. If not, see my blog post, How Do You Install SQL Server Data Tools?
-Created your SQL Server query in SSMS and it is all good to go. If not, see my blog post, Where is SQL Server Management Studio (SSMS)?
-Created the report. All that’s left is to do is add the new column that will house the dynamic image.
-Chosen the images and they are ready to be imported.
How to Add a Dynamic Image to a Report Table in SSRS
This is the high-level process:
First, import the images.
Second, add a column.
Third, update the row properties.
Ensure the Report Data window is open, right-click on the Images node and select Add Image…
In the open window, browse to the location of your images. If you don’t see them, you may need to change the file type to match the image type.
Select the file and click on the Open button.
Repeat the last three steps until all of the images are imported.
Adding a Column to a Report Table or Matrix
In this case I’m using a matrix, but these steps also work for a table. In a nutshell there are no tricks to this. Simply add the column.
Next adjust the column size by first selecting the column. Then, in the properties window, adjust the width. In my case, I adjusted the width to .375 of an inch because it worked well for the images I imported.
Update Row Properties
Up to this point, everything should be fairly straight-forward, and once you get the hang of things this last step will be easy too. I must admit, though, that it was tough going at first.
First, you need to put together your IIF statements. Surprisingly, this step is very similar to the one I described in, How to Add Alternating Row Colors to SCCM Reports. The only difference is that instead of applying only a background color, in this case I used both images and background colors in my report. I did this so that the results wouldn’t look funny with a white background behind the images in the grey rows.
Here are the statements I used:
=IIF(Fields!Online_Status.Value = “Offline”, “grey”, IIF(Fields!Online_Status.Value = “Online”, “green”, “black”))
These two IIF statements define my dynamic images. The first one checks for the status of “Offline.” If it is true then the grey image is selected. If it is not true it goes to the second IIF statement. In the second IIF statement, it checks to see if the status is “Online.” If it is true then the green image is selected, otherwise the black image is selected.
Once you have your statements, locate the Fill section in the Properties window. Expand the BackgroundImage row.
Change the Source value to Embedded.
Paste your IIF statement into the Value box.
Change BackgroundRepeat to Clip.
With that last step completed, dynamic images are displayed in your report.
Looking at the report above, don’t the images on the left-hand side look great?!
By the way, the Locate Computers by Username report is Enhansoft’s free report giveaway for the month of March 2019. Want to know more about it? Please see this post. If you have any questions about how to add dynamic images to a SCCM SSRS report, please feel free to contact me at @GarthMJ.