How to hide blank field in AGOL

5289
12
06-20-2017 08:32 AM
SteveMcCord1
New Contributor II

I have a country table where some attribute data where some of the complete data fields are applicable and some are not so the field is blank <Null>.  For example, tick-borne encephalitis in only applicable in 10 countries so it is blank in the other 242 countries.   How to I configure a popup in AGOL to display the field (tick-born encephalitis) when data is present and not display it which the field is empty? 

Tags (1)
12 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Stephen,

Currently, there is not an out-of-the-box solution for this. 

Would applying a unique symbology to the layer help at all?  You could have one color indicate there are tick-born encephalitis, and another color indicate those that are NULL.

SteveMcCord1
New Contributor II

Hey Jake,  can this be done with Arcade?  If {field2} is 'null', then don't display {field1} in popup?

JakeSkinner
Esri Esteemed Contributor

I just took a quick a look at this, I don't think this is possible using Arcade either.  Creating an expression for a pop-up using Arcade will add a new field to your pop-up that will display the new information (i.e. field1 + field2).

SteveMcCord1
New Contributor II

No, symbology is not the issue as the null values should not be shown. I think it can be done in arcade but I’m not sure how to do it with 20 variables in arcade.

Steve

Get Outlook<https://aka.ms/sdimjr> for iOS

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Steve McCord‌ you can do this using a Custom Attribute pop-up.  Below are the steps:

1.  Choose A custom attribute display in the pop-up

2.  Click the View HTML Source

3.  Configure a span HTML element before any line that you do not want to display if it's NULL:

<b>Address:</b>  {FULLADDR}<br />
<span style="display:{expression/expr2}">
<b>Value:</b> {PREDISVAL}
</span>

Update the expresssion/expr2 with the appropriate Attribute Expression

4.  The Arcade for the Attribute Expression would be:

IIF(isEmpty($feature.PREDISVAL), "None", "inline")

This will then hide the field in the pop-up when the value is NULL:

Not sure if there is a way to simplify this for 20 different fields, but this should be a start.

SteveMcCord1
New Contributor II

Thanks, Jake. Let me work through this and see how it functions.

Steve

0 Kudos
DeborahCohen2
New Contributor II

Hi Jake,

I have a related question, this worked for me but one of my expressions is testing a Date field. It is configured as 12/12/20 in the configure attributes list, but the arcade expression changes the date format to this very lengthy format (first snip). I can't figure out why. Below is the IIf expression. Any ideas?

Thanks,

Deb

Arcade snip

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Deborah Cohen‌ you can try returning the date as a string instead:

var editDate = Date($feature["last_edited_date"])
var stringDate = Text(editDate, 'MMMM, d, Y h: m :s')
return stringDate

SteveMcCord
New Contributor

Jake,  Thanks for the response.  I'm using multiple fields each for specific immunizations which are linked to sites like the WHO, CDC, & NHS for more specific details.  

0 Kudos