ARCGIS ONLINE pop-up

1056
3
Jump to solution
10-12-2017 08:26 AM
NathanWood2
New Contributor III

pop-up configuration‌ 

I’m configuring a ‘Custom Attribute Display’ pop-up that uses an expression to define part of the code. A snip of the code for the custom pop-up looks like this:

 

<tr><td>Application:</td><td>{expression/expr0}</td></tr>

 

And the expression looks like this:

 

var avail = $feature["GIS_DB.dbo.CharterPullComplete.SpaceAvail"];

var apply='<a href=https://schooloptions.mnps.org/>Apply Now</a>'

var sorry='<div style="color:red;">Not taking applications</div>'

When(avail=='Green', apply,avail=='Yellow', apply, sorry);

 

My intent was that my pop-up, depending on which condition was met would look like this:

 

Application:        Apply Now

Or

Application:        Not taking applications

 

But instead it looks like:

 

Application:        <a href=https://schooloptions.mnps.org/>Apply Now</a>

   Or

Application:        <div style="color:red;">Not taking applications</div>

 

 

Is it possible to specify that the string that is returned by the expression is code?

 

Thanks...Nate

0 Kudos
1 Solution

Accepted Solutions
KellyGerrow
Esri Frequent Contributor

Hey Nathan,

Check out the update to this blog that outlines a strategy to do this:

https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-disp...

You can do this using similar logic. Here is an example I made classifying Earthquake magnitudes by colour. (It's not a stellar cartographic example, but you should be able to find the different classifications.)

App: https://webapps.maps.arcgis.com/apps/Minimalist/index.html?appid=5789741c078f4464a4657ae77e81fc28 

Web Map:https://www.arcgis.com/home/webmap/viewer.html?webmap=7cf2c86a661f45d29c29a568164bbaa1 

 

I made 6 expressions for each classification, similar to which returns the value of moderate if the magnitude is greater than 5 and less than 6 and returns nothing if the expression doesn't apply: 

IIf($feature.mag >= 5.0 && $feature.mag < 6, "Moderate", "")

 

When configuring the pop up, include all of the expressions in different colours. The correct expression will display for the mag value.

For your specific example try creating expressions for each status then colour code each response in the pop up.:

IIf($feature.completed == "under construction",  "under construction", "") 

 

Logical Functions | ArcGIS for Developers 

 

-Kelly

View solution in original post

3 Replies
KellyGerrow
Esri Frequent Contributor

Hey Nathan,

Check out the update to this blog that outlines a strategy to do this:

https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-disp...

You can do this using similar logic. Here is an example I made classifying Earthquake magnitudes by colour. (It's not a stellar cartographic example, but you should be able to find the different classifications.)

App: https://webapps.maps.arcgis.com/apps/Minimalist/index.html?appid=5789741c078f4464a4657ae77e81fc28 

Web Map:https://www.arcgis.com/home/webmap/viewer.html?webmap=7cf2c86a661f45d29c29a568164bbaa1 

 

I made 6 expressions for each classification, similar to which returns the value of moderate if the magnitude is greater than 5 and less than 6 and returns nothing if the expression doesn't apply: 

IIf($feature.mag >= 5.0 && $feature.mag < 6, "Moderate", "")

 

When configuring the pop up, include all of the expressions in different colours. The correct expression will display for the mag value.

For your specific example try creating expressions for each status then colour code each response in the pop up.:

IIf($feature.completed == "under construction",  "under construction", "") 

 

Logical Functions | ArcGIS for Developers 

 

-Kelly

JackHawkins
New Contributor

Thank you, Kelly. That worked perfectly. It was not as straightforward as the way I originally thought, but it worked, and also gave me some ideas on other ways I could enhance the experience for the user.

I ended up creating an expression for the URL:

var avail = $feature["GIS_DB.dbo.CharterPullComplete.SpaceAvail"];
var url='https://options.mnps.org/'
var blank=''
When(avail=='Green', url,avail=='Yellow', url, blank);

And then one for the link and one for the label, each based on whether the URL was blank or not and showed the link and label based on that criteria in the pop-up. Thanks for your help!

RebeccaStrauch__GISP
MVP Emeritus

Jack, please remember to mark an answer (Kelly's) as correct so this thread can be closed.

0 Kudos