Attempting to use logical functions to determine when fields appear on pop-up.

337
1
07-29-2019 04:57 PM
deleted-user-VlUAfOaDHQ3-
New Contributor

Hi All, 

I have successfully created a logical function using IIF but the end result is not appearing as I'd like. 

I followed this previously asked question:https://community.esri.com/thread/225577-arcade-expressions-conditionals-and-popups as what I want is similar. It seems like using the IIF would not cause my expression to show up on the pop-up if it was FALSE.

Below is my expression. The expression is labelled "Custom" 

IIF($feature["TYPE"]=='STRAW', $feature["TYPE"],"")

‍‍

The function works as expected and it returns this on my pop-up

Field
CustomSTRAW

My issue though is if $feature["TYPE"] != 'STRAW' my pop-up displays 

Field
Custom


What I want is if it is False for it not to appear on my pop-up. What am I doing wrong or misunderstanding? 

0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Quang Tran ,

Unfortunately how you want the expression to work, is not the way the function works. When your expression returns an empty string the empty string will be shown together with the name of the expression ("custom" in your case).  In ArcGIS Pro you would be able to create HTML in your expression and create the visualization as you want to obtain, but in ArcGIS Online, this is not possible (yet?). 

There is a different way to do this, but it will require more work and more expressions. You can create a custom HTML pop-up and embed Arcade expressions in the html and force elements to be hidden if for instance a field is empty or does not have a value you want to show. An example you can find here: https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-disp...