SSRS Display Either Embedded or Database Image

Go To StackoverFlow.com

0

I want to show an image on my report if that image exists in the database for the person record displaying on the report. However, if that person record does not have an image, I want to display an embedded image in the exact location where the database image would be. When I put them on top of each other and toggle the visibility based on an expression, SSRS seems to be "holding" the space for the image which is hidden. For example, if the embedded image is on top of the database image on the report and the embedded image is set to hidden SSRS will show a blank space to the right of the visible image.

I have tried to put the images in a table and toggle the columns without luck and played around with the image settings (AutoFit, Clip, etc). It does not look like we can use an expression because they are of different types (embedded vs. database). Is there any way to do this beyond putting the embedded image in the database?

2012-04-04 21:09
by Drew
I don't have time to test this today, but what happens if you put each image item into a separate rectangle, and try setting the rectangle visibility? Rectangles are often treated a little differently when laying out report items: they allow a different hierarchy to be used when laying out later items on the page, so those aren't dependent on the size of the items in the rectangle - Jamie F 2012-04-04 22:25
The rectangle did not work because SSRS would not allow us to put the rectangle on top of the another rectangle. It would automatically add the rectangle inside the one we wanted on the bottom - Drew 2012-04-05 14:10


0

The way we got this to work is to create a Tablix and then toggle the column visibility. It is interesting that the Tablix works differently than a Table, but it does.

We found this which discusses the issue:

http://sqlserverpedia.com/blog/sql-server-bloggers/dealing-with-white-space-due-to-a-hidden-textbox-in-reporting-services/

2012-04-05 14:09
by Drew


0

Put a rectangle object in the cell of the table so that you can have free form placement of the image item. Add a default embedded image into your rdl, call it defaultImage. Since the data type from the database will be a byte[], in order for you to check if the database field value is null, your visibility expression on the default embedded image will be:

 =Not(IsNothing(Fields!{FieldName}.Value))

Now that your default image will hide when there is a field value from the database. Place a new image object on top of the default image, same size. This image will use the database field value directly, no suppression needed. When the byte[] is empty the database image will not show, and the embedded (default image) will show.

2015-12-10 13:38
by Mike
Ads