Select to view content in your preferred language

Custom pop-up (if/else statement) based on attribute values, ArcGIS Online

12354
13
Jump to solution
09-09-2015 02:00 PM
NataliyaLys
Frequent Contributor

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,

Tags (2)
1 Solution

Accepted Solutions
ChrisWiebke
Regular Contributor

IIf($feature.Field == "Camping", "Camping", "")

View solution in original post

13 Replies
NathanielRoth1
Occasional Contributor

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.

0 Kudos
NataliyaLys
Frequent Contributor

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.

0 Kudos
deleted-user-7UNnYoN7RMBl
Deactivated User

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

0 Kudos
NataliyaLys
Frequent Contributor

Jacob,

No, I didn't get it to work with javascript. I am planning to do the schema change.

Thanks,

0 Kudos
KyleBalke__GISP
Frequent Contributor

Nataliya,

Sounds like building an Arcade Expression would suit your needs.

Check out the related blog posting.

Kyle

NataliyaLys
Frequent Contributor

thanks.

0 Kudos
ChrisWiebke
Regular Contributor

IIf($feature.Field == "Camping", "Camping", "")

NataliyaLys
Frequent Contributor

I got it working with Arcade. 

HassanMuhammad
Emerging Contributor

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

0 Kudos