Hi all,
I’m building an app in ArcGIS Experience Builder with a List widget that displays features collected from a Survey123 Connect survey. Each survey submission allows attachments, but since the attachments question isn’t required, not every record has one.
So far, I’ve set the List widget image to pull from dynamic content, and it works great for features with attachments — the correct photo shows up. However, for features without attachments, it shows a grey image box. I would like to instead have a placeholder image of my choosing display.
Question:
Is there a way to configure the List widget to use a fallback/placeholder image (instead of a grey image box) when no attachments exist?
Can this be handled directly in the List widget?
Or would it require an Arcade expression, custom code, or another workaround?
The issue:
For features without attachments, the List widget just shows a blank grey image box.
I’d like it to instead display a default placeholder image (a generic photo that I specify).
What I’ve tried so far:
I was able to get this behavior to work in Arcade for the web map pop-up, where I can show a placeholder if no attachment exists.
But I haven’t found a way to replicate this in the List widget.
I also can’t rely on a calculated field, since the dataset is continuously growing and I need this behavior to update automatically without re-running field calculations.
Thanks in advance for any advice or examples!
Have you checked out the new Arcade capabilities in Experience Builder (ArcGIS Online version)? I think you could add your data via Arcade, then substitute an image for features that don't have one.
I just tried this with some of the iNaturalist data on Living Atlas (though I can't seem to find records that don't have an image). Your code will be different in the sense that you're checking whether the feature has an attachment. Also, if you have other widgets connected to your data, you'll want to make sure they're interacting with the data brought in via Arcade in addition to (probably) your map data.
// Bring in solidago gigantea features from iNaturalist and check whether they have an image; if they don't, substitute an image
var obs = FeatureSetByPortalItem(Portal("https://www.arcgis.com"), "99e3e9ccfaec422db6d4266569aa19d7", 0, ['observation_uuid', 'scientific_name', 'image_url'], false)
var species = 'Solidago gigantea'
var obsfilt = Filter(obs, 'scientific_name = @species')
// Set up the structure of your new featureset
var obsdict = {fields: [{name: 'observation_uuid', type: 'esriFieldTypeString'}, {name: 'scientific_name', type: 'esriFieldTypeString'}, {name: 'image_url', type: 'esriFieldTypeString'}], geometryType: '', features: []}
for (var i in obsfilt) {
var img = DefaultValue(i, "image_url", "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/Solidago_gigantea01.jpg/500px-Solidago_gigantea01.jpg")
Push(obsdict['features'], {attributes: {observation_uuid: i.observation_uuid, scientific_name: i.scientific_name, image_url: img}})
}
return FeatureSet(obsdict)