External Images in Report Builder
Hii all, I m using External Images in my report. I have set "Image source" to "External" and in the "Use this Image" section I have defined an expression like ="http://webserver:21/Images/" & <Field Name from Data base> & ".jpg" now this generates Images like http://webserver:21/Images/A.jpg as per the values from database. Now suppose if image is not present- for instance http://webserver:21/Images/Z.jpg is not present then it should show Image http://webserver:21/Images/Default.jpg. How can I achieve this? Aditya Pratap Singh
December 14th, 2011 12:38am

Hi Aditya, Please let me know if my understanding is correct. If the "Field Name from Data base" has no value then you should show the default image. My understanding is that the value of the default image also comes from the database field. If this is so then you can modify your query in the dataset set by using the CASE statement. Something like Case when Database_col1 is Null then "default" else Database_col1 as DBfield. So field will always have the value either default or the value of the image. HTH, RamRam
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2011 1:22am

Hi Ramakrishnan.lh, No the case is not that the "Field From Database" will always have a value. Consider a scenario where I have 5 values coming from database A,B,C,D,E. and http://webserver:21/Images/A.jpg, http://webserver:21/Images/B.jpg http://webserver:21/Images/C.jpg are present that is these URL will have an Image. and http://webserver:21/Images/D.jpg http://webserver:21/Images/E.jpg does not exist then it should show Image "http://webserver:21/Images/Default.jpg" Thanks Aditya Pratap Singh
December 14th, 2011 1:29am

Hello Aditya, This cannot be done directly in SSRS. You need to write a custom code to check whether the image exists or not. I have found a similar post in this link which might give you an idea. http://stackoverflow.com/questions/2688826/ssrs-report-loading-external-images-image-not-found-can-i-hide-the-image-cont HTH, RamRam
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2011 1:46am

Hi Ramakrishnan.lh, The post that you told me use web requests for which the report builder does not have permissions and while running the code it throws an exception of System Security Exception. So any other work around for this. ThanksAditya Pratap Singh
December 15th, 2011 12:43am

Hi Aditya_Pratap_Singh_2708, Just as Ramakrishnan.lh said, the custom code maybe the only way which could be used to verify whether the relevant image URL exists or not, this is definitely the best choice for you. The custom function you referred in RS expression, so you need to set the CodeGroup "Report_Expressions_Default_Permissions" to be FullTrust in rssrvpolicy.config or RSPreviewPolicy.config files to configure the security policy. If you run the report In Reporting Services, you need to modify file below: C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\rssrvpolicy.config If you run the report In Visual Studio Preview, you need to modify file below: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config Thanks, Bill LuBill Lu TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
December 16th, 2011 4:24am

Hi Aditya_Pratap_Singh_2708, Just as Ramakrishnan.lh said, the custom code maybe the only way which could be used to verify whether the relevant image URL exists or not, this is definitely the best choice for you. The custom function you referred in RS expression, so you need to set the CodeGroup "Report_Expressions_Default_Permissions" to be FullTrust in rssrvpolicy.config or RSPreviewPolicy.config files to configure the security policy. If you run the report In Reporting Services, you need to modify file below: C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\rssrvpolicy.config If you run the report In Visual Studio Preview, you need to modify file below: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config Thanks, Bill LuBill Lu TechNet Community Support
December 16th, 2011 12:23pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics