SSRS Display Either Embedded or Database Image - reporting-services

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?

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/

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.

Related

SSRS Report PDF image rendering issue

I am building a label report that requires the user to input a Bulk Order Number that will generate multiple labels. When viewed in preview mode and on the report server, images on the report for postage and company logo appear on every instance of a label (report page).
However when exported to PDF, these images only render on the first label (page)
I considered this may not be an issue, as the user could print from the report server when accessing the report. This isn't the case, as when trying to print, report server creates a PDF for you to print from. There are no other options regarding printing other than page size and orientation, a PDF seems to be the only method from which you can print from.
The images I use have the visibility controlled by parameters, so you can select 1st or 2nd class postage, and choose to have the logo visible.
Each image also has the RepeatWith property set to the Tablix that contains order and address details.
When exported to word, the labels all appear as desired with postage and/or logo images on each instance. This is a step I would like to avoid, as it would be much nicer to have the user print directly from the report server, even if this still requires a printer friendly PDF to be created.
I have attached am image to show PDF output.
Any ideas how I can get these images to render on each label (page)?
EDIT
Image of design page
Based on the design view image you posted, it looks like the only thing repeating is your tablix containing the address information. The SSRS RepeatWith property doesn't seem to work well with .pdf exports so the workaround for this would be to drop everything into a single cell on a list object and grouping using the Order_No to repeat everything. This should remove the need to mess with RepeatWith and give you the desired results.

Textbox on top of picture

In Reporting Services I'm trying to place a table over a picture. Within the Report Builder it works, but whenever the report is run, the table is moved to beneath the picture. I've thought about several workarounds, but none of them has worked:
Creating a rectangle with my picture as the background, and placing the table of top of the rectangle. This works, but it doesn't show the picture in the Excel sheet when exporting the report. I need the picture in the report, so this solution is not satisfactory.
Creating a report where the background image is set to the picture I need, and then importing it in my main report as a subreport. The weird thing here is that background images WILL show up in Excel when you just export the report with the background image. However, when importing that report within another report, it doesn't show up anymore in the export.
Set the picture as background for the main report. the problem is that the picture will be the background for every page/sheet. If someone nows a possibility to set a specific background per page, I would also be helped!
TL;DR: Is it possible the overlay a table of top of a picture? Or is it possible to set a background image per page, so I can use that instead?
You can overlap text and an image but it may not show up that way depending on how you want to render it. I think it works with PDFs and DOCs but not much else.
You can use a background image for the report or just the table's background.
Click on either the Body or the table and use the Background Image properties.
Put an Expression in the Background Image Value field with your logic to determine which image to display.
https://technet.microsoft.com/en-us/library/ms156482(v=sql.100).aspx

Background image repeats despite setting to "Clip"

I am trying to show a "check" or "X" image inside a tablix cell based on a Condition. I have added both Images to the image Folder and am setting the BackGroundImage Value property to this expression...
=IIF(Fields!PASS.Value = 1,"CheckMark","XMark")
I've also set Background Repeat to Clip. Inside Preview view it looks fine, but when pushing the rdl to the server and running the report locally, the image continues to repeat to fill the textbox.
I am running IE8 and SSRS 2008. Is there a better approach in doing this without setting Background Image property, realistically I'd like to just set the TextBox value property.
I found that I was only getting the repeating Background image 'feature' despite having BackgroundRepeat set to 'Clip' when using an image encoded in a database field or where the name of the embeded image was coming from the database i.e. where Value was set to an Expression.
What I found worked was to set BackgroundRepeat to the Expression ="Clip".
Note that I'm working in 2013/2014 RDL/RDLC but it seems to be the same issue.
One alternative would be to use the show/hide parameter in the text box to control which of the images gets hidden. I'm not sure if this would solve your not repeating option, but it is something you can try. You would set both images to show in each box and write a conditional formula (the inverse of your formula above, pretty much) to hide an image based on value. I'm not sure if that would mess up the alignment for you though, unless you can place the two images on top of eachother since only 1 should show anyway.
It seems that you are not alone with this issue, as there are several other posts about it going back as far as 2010 when I google it. The last status I saw was that it was submitted as a bug to Microsoft, and it seems all of the users had to find workarounds.
I was having the same problem. I found by setting the MIMEtype and setting BackgroundRepeat to Clip fixed the issue.

SSRS 2012, data overlat issue on top of image

I am trying to display data on top of image and can't use watermark/background image for the scenario. In crystal we can use data on top of image and set the property for image gobackward and for data fields cometofront, so that it will display the image and data together. But in SSRS the data is displaying below the image. Please help me to display the data on top of image, and I have multiple images to the displayed in a single report with data.
Right click on the cell that you want an image in. Then Click properties. Then click fill. Then change image source to 'embedded'. Then import your image.

SSRS 2008 two column report only shows data on the left column

I am creating a new report that needs to show data in two columns. I did the following:
Report Properties: added the second column
Insert a List control from the toolbox
Insert a rectangle inside the List control
Insert a textbox inside the Rectangle
When I click on Preview tab, the report only shows data in the left column and then continues to the 2nd page in the same way instead of using the 2nd column.
List controls are not really needed. If you place the data in two tables or textboxes at the same height, they will display next to each other. If you have to, place both in a rectangle or set the KeepTogether property.
This is because it only works in "Image" and "PDF" export formats. From the relevant documentation on columns (emphasis mine):
Columns are only applied when you render and print reports in PDF or Image formats.
The "Preview" window doesn't use the PDF or Image renderer.
Personally, I'm a little surprised that it hasn't been implemented in the MS Word renderer, but I've tested this and indeed it doesn't work there either.
A little earlier in the same documentation, it hints at the inner workings of the "columns" feature:
...For example, suppose you have two columns on a physical page. The content of your report fills the first column and then the second column. If the report does not fit entirely within the first two columns, the report fills the first column and then the second column on the next page. ...
My guess is that in the Preview window, you'll never get to the end of a physical page, so the content never flows to the second column. If you export to -say- PDF, you'll probably get the behavior you're expecting.
Note that the columns do actually have to fit in the report, make sure your report's and report body's width and margins are set correctly.