Views:

You can check for the existence of an image by creating a formula field, which looks for the image name in the image library. If found, it will return some html, if not it returns nothing so you're not left with a gap or formatting that you don't want.


For example, this formula will return a single cell table containing the picture, with padding around the image:

string strImg =@"(!IMG_Photo!)";

if(strImg == "" || strImg == null){
return "";
}else{
return "<table style='padding:0;border-collapse:collapse;border:none;'><td style='padding:5px;'>" + strImg + "</td></table>";
}

 
IMPORTANT NOTE: in the example above we are referencing another field (an Image field) to get the name of the image. The image field contains HTML Attributes, such as border='0'. Make sure that this attribute does not contain double quotation marks "0" or it will break the formula.

Related Products: CMS M365