SSRS displaying image from database - reporting-services

I am trying to display image from database in my SSRS report. The report has two datasets.
For all text boxes etc. I have added value expression as below:
=First(Fields!Branding4Tx.Value, "dsPrintOData_tblProdOrders")
But when I do this in the value field of image box, it return an error.
=Fields!ProdImage1.Value, "dsPrintOData_tblProdOrders"
If I just put =Fields!ProdImage1.Value
it does not return error but does not display any image too.
Please advise.
Thanks

It depends on the value in the ProdImage1 field. If it is a VARBINARY(MAX) data type value, then we can select Database as the image Source. If it is a string of the image URL, then we should select External as the image Source.
The following blog about Rendering images from a database on SSRS reports is for your reference:
http://www.mssqltips.com/sqlservertip/2978/rendering-images-from-a-database-on-ssrs-reports/

Related

Unable to hide graph while exporting to excel

I am working a report in SSRS. that has two sections one is graph and other is Table.
client should able to see both Graph and table on reporting manager but when exported only the table should get exported to excel. Please let me know how to achieve this.Please find the below screenshot. enter image description here
You can set the Hidden property of anything you want to hide to an expression. If you base this on the renderformat you can hide things depending on what format you export in.
This was introduced in 2008R2 so I'm assuming you are not using an earlier version.
Set the 'Hidden' property of the chart or it's container to
=NOT(Globals!RenderFormat.IsInteracive)
This should hide the chart when it's redndered to any other format.
Read this for more details
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/built-in-collections-built-in-globals-and-users-references-report-builder?view=sql-server-ver15
For the chart, you set the Hidden expression to not show if the format is Excel.
=IIF(Globals!RenderFormat.Name = "EXCELOPENXML", False, True)

Microsoft dynamics Mediaset Datatype and SSRS

I have a table called Item in Microsot Dynamics (NAV).
One of the requirement is to display a picture that is attached to the item.
The SQL datatype of this field is "uniqueidentifier".
However, when looking at the development environment for dynamics, I see the following:
How do I retrieve and show this image in an SSRS report please?
For any one looking at this. Navision Dynamics stores images as Mediasets.
These references are stored in the [Tenant Media Set] table and the actual image is in the [Tenant Media Thumbnails] table.
The images are stored as a BLOB . To be able to display these in an SSRS report, you need to ensure that the Compression is set to NO on the field that holds the image. Field name is [Content]
Here is the SQL Query :
SELECT ID, [Media ID], [Content], [Mime Type], Height, Width
FROM [Tenant Media Thumbnails]
You can them simply display this field in the report by applying the following properties to an Image

How to display an image on crystal reports from mysql blob field?

Hi I am creating a crystal report using VB6. I am storing an image in a mysql blob field. I want to display the picture on my report. I have been googling for 1 week but I could not get the solution.
For the graphic control in your report, you will have a property that can take a file path. Set that to the field that has the jpg file name.
Insert an Image on the report (don't drag the blob field - go to the Insert menu.)
Right-click on the image and select Format Graphic. Select the Picture tab and click on the "x-1" button by Graphic Location. Type in your formula here. Click on Save and Close.
And also check there is no Issue with importing the BLOB info to the table. That should do it, I think.

What's up with SSRS parameters and images?

I'm working on setting up a report in SSRS. Our report is somewhat flexible, and I'm looking to dynamically select an image for a cover page based on a parameter.
Here's what I have:
In our Reports db I have an image table set up. To keep things simple, lets just say I have three columns:
ImageName, ImageType, and Image.
Name and type are both varchar while ImageType is varbinary. I've uploaded the images we plan on using as well as their names and associated types to the table.
In my report I have a Data Source and a Dataset for bringing in the above table and columns.
I also have a parameter called "ImageName." I've set this parameter up to use "Image" (from the table described above) as its value field and the label field is set up for "ImageName."
On the report itself I have an image ... control? Report element? Not sure what to call it, but I've set up an image. The image source is set to "Database" and the MIME type uses the lookup function to pull the appropriate image type from the Dataset based on the Parameters!ImageName.Label argument - and that part works a treat - I'm returning the proper MIME type each time.
What doesn't work, and I would expect should work, is setting the image itself. For the "Use this field" field under "Select the image source:" I've tried both =Parameters!ImageName.Value with no success as well as a lookup based on the ImageName.Label from the images Dataset. Neither seem to work.
When I try using the parameter value, I'm getting the error
[rsInvalidDatabaseImageProperty] The value of the ImageData property
for the image 'ImageControlName' is "=Parameters!ImageName.Value",
which is not a valid ImageData.
I get essentially the same error message from the lookup method, it just swaps the lookup code for the Parameters!ImageName code above.
If I attempt to check the type returned by the lookup above I simply get an error. For the parameter if I check the type I get System.String so I decided to print that out and apparently the value of Parameters!ImageName.Value is System.Byte[] for some reason.
I can get an image to display using the First() function, but I need to be able to select the image. I'm guessing I may have to filter. First() has a return type of System.Byte[], which seems reasonable. I just don't understand why my parameter is returning the type of the image data column as a string rather than the data from the image column itself.
So how do I get this working? Is filtering my Dataset my only option? Or is there a way to get the parameter working or to get some function that will allow me to select the appropriate image?
Reason for your error is because of the data types returned by Parameters vs First.
For the Parameters data type returned is of type text and which is not valid image data type hence the error.
For First function it returns the data type based on type of expression and it returns the right type of data type for image and displays the image.
Per Microsoft Parameter Data Type:
A report parameter must be one of the following data types:
Boolean. The user selects True or False from a radio button.
DateTime. The user selects a date from a calendar control.
Integer. The user types values in a text box.
Float. The user types values in a text box.
Text. The user types values in a text box.
When available values are defined for a parameter, the user chooses
values from a drop-down list, even when the data type is DateTime.
Per Microsoft First function data type:
Return Type
Determined by the type of expression.
You are correct to get the right image you need to filter the dataset.
Create dataset which gives ImageName, ImageType, and Image.
Based on image parameter filter the dataset on ImageName.
Now use the following expression to get the correct image data.
=Fields!Image.Value

How to display an image from a SQL query that gives a file path in SSRS Report?

I am working on a report, which I would like to display an image in my database from a query with a parameter. For example:
SELECT pictureATTACHMENT
FROM myDatabase.dbo.ATTACHMENT
WHERE DESCRIPTION LIKE #thisCampaign + '%'
My query returns a file path to the image:
For example:
\\DASERVER\FOLDER\FOLDER\Data\Attachment\filename.png
How do I need to format the expression for the report to display the image?
I have tried doing: =file:\\DASERVER\FOLDER\FOLDER\Data\Attachment\filename.png
But no luck.
Many thanks in advance!!
You should store the image in the database as Image data type not as varchar and more over SSRS should have permission to access the image .
Try this without = and in the image property dialogue box select the image source as External :-
file:///<Location>\Image1.png
With the field from the dataset this can be done using the below expression again selecting the source as External
="file:///"+ Fields!pictureATTACHMENT.Value
If you are storing it as blob data then instead of external chose the property Database from the dropdown menu. Select the pictureATTACHMENT field from your dataset and MiME type as png