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

1683
5
Jump to solution
11-04-2019 09:15 AM
JoeStefanoni
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)
0 Kudos
1 Solution

Accepted Solutions
JoeStefanoni
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
RobertBorchert
Frequent Contributor III

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

0 Kudos
RobertBorchert
Frequent Contributor III

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

0 Kudos
JakeSkinner
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... 

JoeStefanoni
New Contributor III

Thanks!

Joe Stefanoni, GIS Specialist

NJDEP Site Remediation Program

(609) 633-1405

joe.stefanoni@dep.nj.gov

0 Kudos
JoeStefanoni
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")