I'm trying to get a pop-up to return a photo from a URL (with a link) if the Attachment_URL field is not empty, and a text string if it is empty. I'm using the following code. It returns "No photo available" when appropriate, but instead a photo, it returns a table with the key:value pairs as seen in the photo. How do I get it to return the literal text string and not a table?
var attachment = $feature.Attachment_URL
if (isEmpty(attachment)){
return "No photo available"
} else {
return {
type : "text",
text : `<p>Click the photo to open full size in new tab</p>
<p style="text-align:center;"><a href="${attachment}?size=full">
<img class="image_resized" style="width:100%;" src="${attachment}?size=lg" alt="Photo of ${$feature.Common_Name}"></a></p>`
}
}
