Can i eliminate empty values using arcade in my pop up?

05-08-2019 12:07 PM
New Contributor III

I am attempting to create a conditional arcade expression that will list all of the fields that do not have a null value with an individual label and not show the field at all if the field is null. My current expression is below.

if (IsEmpty($feature.ABARTA_WI)){
return ""
} else {
return "Abarata: "+$feature.ABARTA_WI

This expression works in that it does not show the label or null value, but in the ArcGIS Portal pop up, it leaves an empty line for each one that is null, and i need it to not be there at all so the pop up is clean. As you can see below, this is creating empty lines in the popup. 

I would prefer the popup to display something like below, eliminating the empty lines.

Chief: 0.28

Chief WI MKR: 0.28

Enerplus: 0.3

arcade expression‌ arcade pop-ups‌conditional pop ups‌

Any help would be greatly appreciated.

Thank you

16 Replies
Esri Esteemed Contributor

You can, but it will require multiple expressions and some html to do this (if you want to show it using html). Or you can create a larger expression that constructs the text to display and omits empty values. 

0 Kudos
New Contributor III

Well I need this popup to look professional so this is what i need to do. Can you provide further information on what that larger expression would look like?

0 Kudos
Esri Regular Contributor

Using something similar to what you have, you could use an approach like this.


var a = $feature.notes
var b = $feature.popper
var attributes = ""
If (!IsEmpty($feature.notes)){
attributes = a + TextFormatting.NewLine + b
else {
attributes = b
return attributes

If Feature notes attribute is not Empty  Show both attributes.

Else show one attribute


MVP Honored Contributor
Esri Esteemed Contributor

Apart from the post mentioned by Ken, there are some comments that will be relevant for you:

0 Kudos
New Contributor III


This is a confirmed bug, and the arcade script will not produce the results we are asking for. This bug is not repaired until the 10.7 license level.

0 Kudos
Esri Esteemed Contributor

Can you share the number of the bug and the description?

New Contributor III


In Portal for ArcGIS Map viewer, an Arcade Expression to configure fields in a pop up does not honor the TextFormatting.NewLine

New Contributor III

Xander Bakker

I can write one-off conditional expressions but how do you combine multiple conditional expressions for different fields? In the example below Field 1 & 2 are from one layer and Field 3 is from the popup layer. I want to only return a value and if it is null do not return an empty space. I can write an expression for each field that is null and only return the other 2 or all 3 if all values are present but not how to combine all expressions.


Field1       Field1  or  Field2  or Field1  or Field3 and so on

Field2       Field2       Field3      Field3



I know how to return all fields even if it's null but it leaves a space/s.



This is my expression:

var buildn = FeatureSetByName($map,"NLCOG Buildings",["BUILDING_N"])
var fsIntersectbuild = Intersects(buildn, $feature)
var fbuildn = first(fsIntersectbuild)

var buildu = FeatureSetByName($map,"NLCOG Buildings",["USAGE_"])
var fIntersectbuild = Intersects(buildu, $feature)
var fusage = first(fIntersectbuild)

var occp = $feature.OCCUPANCY

iif (fbuildn.BUILDING_N == null, fusage.USAGE_ + TextFormatting.NewLine + occp, fbuildn.BUILDING_N + TextFormatting.NewLine + fusage.USAGE_ + TextFormatting.NewLine + occp)
//iif (fusage.USAGE_ == null, fbuildn.BUILDING_N + TextFormatting.NewLine + occp, fbuildn.BUILDING_N + TextFormatting.NewLine + fusage.USAGE_ + TextFormatting.NewLine + occp)
//iif (occp == null || occp == 'SINGLEF', fusage.USAGE_ + TextFormatting.NewLine + fbuildn.BUILDING_N, fbuildn.BUILDING_N + TextFormatting.NewLine + fusage.USAGE_ + TextFormatting.NewLine + occp)

Each one of the iif statements works independently. I've tried using the When function but each field is different so it doesn't work or not the way that I wrote it.

Any help would be appreciated.