Tuesday, April 06, 2010 10:19 PM
I am new to SSRS and need to create a report that displays an image based on a parameter. Example:
If @Account = 1, then display 'Image 1'
If @Account = 2, then display 'Image 2'
Can you please tell me the best way to store the image in the db table and then how to display the image in the report? Based on suggestions I've found I have tried storing the path to the image file in the db table that also includes the @Account field and added the image from the Toolbox in SSRS, but am unable to create the custom code needed to display it correctly.
I have access to modify the table if needed and am using SQL Server and SSRS 2008.
Thank you for your help and please let me know if I should provide more information.
Tuesday, April 06, 2010 11:37 PM
oops just noticed you are doing 2008 and I looked into 2005, but it shouldnt be too different
if you select the image in the layout and go to the properties window there should be a value field in the Data section where you can create an expression like so:
=switch(Parameters!pic.Value = 1, "image1.jpg", Parameters!pic.Value = 2, "image2.jpg")
Wednesday, April 07, 2010 4:48 AM
1) Just check whether this blog post addresses your issue
Here, rather than storing the path in the DB, you can store the image itself if you want to use the database.
2) You can also store the images in your report rather than the database by embedding them in the report. For this, right click on the Images in the report data panel and select add new image. Select the embedded option and then upload the image you want by giving the source. Upload all the images you want, lets say Image1 and Image2
Now you can use the image toolbar and then modify the value property in the wizard to the expression
Note that the names of the images are in quotes.
Cheers, Jason ( http://road-blogs.blogspot.com ) P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Sunday, April 11, 2010 5:43 PM
Reporting Servcies uses three methods to display the image, External, Embedded and Database. To add image to the report,
In Design view, click Image in the Toolbox.
Click a location on the design surface and drag the mouse to create a box that is the size of the desired image. Alternatively, click the design surface to create an image item of fixed size.
In the General page of the Image Properties dialog box, type a name in the Name text box or accept the default.
(Optional) In the Tooltip text box, type text to display when the user hovers the mouse over the image in a report rendered for HTML.
In Select the image source, click the option that specifies where the source for the image exists.
External Choose this option when you specify an image that exists on the report server or on a Web server. For this option, you must type a URL to the image or select a dataset field that contains a URL to the image.
Embedded Choose this option when you specify an image that is part of the report definition. To add a new embedded image, see How to: Embed an Image in a Report Definition (Reporting Services).
Database Choose this option when you specify a dataset field that is bound to a database field that contains an image. For more information, see How to: Add a Data-Bound Image (Reporting Services).
(Optional) Click Size, Visibility, Action, or Border to set additional properties for the image report item.
To display the image dynamically, please add all images in the same position. Set the expression using IIF function in the visiable property to determine which one would be visiable by parameter selection.
Yao Jie Tang -Microsoft Online Community
Sunday, April 18, 2010 3:24 PM
Here is the link for creating ssrs reports with embedded images also based on conditions
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)