In the ArcGIS online map I would like to customize the pop-ups to show only specific data from the attributes. The map I am working on shows parks, and in the pop up window i would like to list available amenities in each park. The problem is that in the attribute table each amenity correspond to the specific field, and the values are Yes/No for the amenities (image from attribute included below).
I know what I am trying to do, but I don't know how to accomplish it:
Basically I would like to write the HTML 'if/else' statement in the pop-up, do the following:
example:
if 'Camping Available' = Yes
return 'Camping'
else
return (nothing)
I would have to do it for each field.
I don't know if anyone has done it with the pop-ups in ArcGIS online, but I would appreciated any suggestions.
Here is the link to my map: http://omaha.maps.arcgis.com/home/webmap/viewer.html?webmap=a72a92754ef4400e8a79116d68ccb93d
Thank you,
Solved! Go to Solution.
IIf($feature.Field == "Camping", "Camping", "")
I handle this type of thing by preconstructing an html snippet for the feature that can be used in the popup. I do it using a python script that loops through the features, and assembles the snippet, and writes it into a new field.
Thank you. My co-worker mentioned that he could probably do something like that with python. I was hoping to do it interactively in the pop-up without modifying my schema, but if I don't get anywhere with html/javascript, I might have to go python route.
Hi Nataliya,
I am trying to do the same thing, did you ever get it solved with javascript or did you have to use the pre-constructed schema change?
Jake
Denver, CO
Jacob,
No, I didn't get it to work with javascript. I am planning to do the schema change.
Thanks,
Nataliya,
Sounds like building an Arcade Expression would suit your needs.
Check out the related blog posting.
Kyle
thanks.
IIf($feature.Field == "Camping", "Camping", "")
I got it working with Arcade.
Hi Chris,
What if we have multiple attributes in a field, how can we combine all below in one statement/expression?
IIf($feature.Material == 10, "Steel", "")
IIf($feature.Material == 11, "Aluminum", "")
IIf($feature.Material == 12, "Plastic", "")
The statement like below doesn't work for me.
IIf($feature.Material == 10, "Steel", IIf($feature.Material == 11, "Aluminum", ""))
Thanks
Hassan