Show/Hide Image in Report Builder with Expresssion
I am using Report Builder 2.0 to generate letters. Each of my letters has a different image. In the Image Properties , I have set the image source to External, and use this expression to load it: = "/Printing/Logos/" & (Fields!DealerLogo.Value) & ".png" This works fine, until I have a row that doesn;t have an image. Is there a way I can suppress the image if none is found? Currently I get the red x when no image is located.
October 15th, 2010 2:18pm
1. You can set hidden property of the image based on the value of (Fields!DealerLogo.Value) 2. You can set the default image location when there is NULL in DealerLogo field in your query
October 15th, 2010 2:31pm
Thanks for the reply, I don;t have a Fields!DealerLogo.Value because the image is external and not in my dataset. How can I set a defautl image then?
October 15th, 2010 2:40pm
Thanks for the reply, I don;t have a Fields!DealerLogo.Value because the image is external and not in my dataset. How can I set a defautl image then? You are using hard coded location "/Printing/Logos/" in your image expression, it means you can save any default image on the location "/Printing/Logos/" e.g. "/Printing/Logos/Default.jpg" and then you can edit your query to return "Default.jpg" in case there is no location for row, e.g. ISNULL(DealerLogo, 'Default.jpg') as DealerLogo. By doing so it will be evaluated as ""/Printing/Logos/Default.jpg" on report. And alternativery you can set the Hidden property of the image based on the value of Fields!DealerLogo.Value , i.e. access the hidden property and select expression then set the following expression: =IIF(Fields!DealerLogo.Value IS NOTHING, TRUE, FALSE) Thanks
October 15th, 2010 3:00pm