Customizing an AGO pop-up to exclude an attribute field if the value is null

102
5
Jump to solution
11-04-2019 09:15 AM
Highlighted
New Contributor III

Is it possible to configure an AGO pop-up so that a field is only displayed in the pop-up when the value is not null?

In other words, I have a specific attribute (Coal Gas Sites) that is only populated for a number of the total number of sites in my feature service.  I would only like to display the Coal Gas Sites attribute in my pop-up window when the value is not null and not have it present when the value is null.  Can this be done?

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor III

We tweaked the HTML and Arcade code that was provided via this forum and found that the following worked:

Fields to be displayed in the Pop-Up (NPL Status is the field with Null values):

 

Site ID: {SITE_ID}
PI Name: {PI_NAME}
Status: {STATUS}
NPL Status: {NPL_STATUS}

 

HTML Code for the Pop-Up Configuration:

 

<b>Site ID:</b> {SITE_ID}<br />

<b>PI Name:</b> {PI_NAME}<br />

<b>Status:</b> {STATUS}<br />

<span style="display:{expression/expr0}">

<b>NPL Status: </b>{NPL_STATUS}

</span>

 

Custom Attribute Expression in Arcade needed to remove both the field name and value when null :

 

IIF(isEmpty($feature.NPL_STATUS), "none", "inline")

View solution in original post

5 Replies
Highlighted
Frequent Contributor II

No I do not believe so, it is an all or nothing.

Reply
0 Kudos
Highlighted
Frequent Contributor II

I take it back.  Have the feature in your web map two times using filters to make it visible if that field is null and not visible if that field is null and have it turned off in the pop up if the field is null

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Joe,

This can be accomplished with Arcade.   Check out the following blog post:

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

Highlighted
New Contributor III

Thanks!

Joe Stefanoni, GIS Specialist

NJDEP Site Remediation Program

(609) 633-1405

joe.stefanoni@dep.nj.gov

Reply
0 Kudos
Highlighted
New Contributor III

We tweaked the HTML and Arcade code that was provided via this forum and found that the following worked:

Fields to be displayed in the Pop-Up (NPL Status is the field with Null values):

 

Site ID: {SITE_ID}
PI Name: {PI_NAME}
Status: {STATUS}
NPL Status: {NPL_STATUS}

 

HTML Code for the Pop-Up Configuration:

 

<b>Site ID:</b> {SITE_ID}<br />

<b>PI Name:</b> {PI_NAME}<br />

<b>Status:</b> {STATUS}<br />

<span style="display:{expression/expr0}">

<b>NPL Status: </b>{NPL_STATUS}

</span>

 

Custom Attribute Expression in Arcade needed to remove both the field name and value when null :

 

IIF(isEmpty($feature.NPL_STATUS), "none", "inline")

View solution in original post