Arcade 'When' statement and empty fields

627
4
02-18-2020 02:22 PM
JayHodny
Occasional Contributor III

Hi.  I am working with the January 22, 2020 FEMA data release for my area.  I am using the Flood Inquiry web map and app solution.  I am new to Arcade.  I am trying to create an expression using the 'When' function to provide some descriptive text in the web map and application pop-up.  All works well except when I have no value in a record in the ZONE_SUBTY field.  How do I have the text written in the pop-up for empty fields?  Below is the current Arcade expression.  The string in italics is the troublemaker.  Thanks in advance, Jay

var zonesubtype = $feature.ZONE_SUBTY;
When (zonesubtype == 'FLOODWAY','Floodway designation of AE',zonesubtype == '','AE - An area inundated by 1% annual chance flooding for which BFEs have been determined',zonesubtype == '0.2 PCT ANNUAL CHANCE FLOOD HAZARD','X - An area determined be 0.2% annual chance flood hazard',zonesubtype == 'AREA OF MINIMAL FLOOD HAZARD','X - An area of minimal flood hazard','')

0 Kudos
4 Replies
XanderBakker
Esri Esteemed Contributor

Hi jhodny@Newark.de.us_CityOfNewarkDE ,

Perhaps this would work:

var zonesubtype = $feature.ZONE_SUBTY;
When (IsEmpty(zonesubtype), 'Specify what to return here...',
      zonesubtype == 'FLOODWAY','Floodway designation of AE',
      zonesubtype == '','AE - An area inundated by 1% annual chance flooding for which BFEs have been determined',
      zonesubtype == '0.2 PCT ANNUAL CHANCE FLOOD HAZARD','X - An area determined be 0.2% annual chance flood hazard',
      zonesubtype == 'AREA OF MINIMAL FLOOD HAZARD','X - An area of minimal flood hazard',
      '')
0 Kudos
JayHodny
Occasional Contributor III

Hi Xander,

I was close, as I was trying to use the ‘IsEmpty” function before my initial GeoNet post. Here is what I am using now, but still no luck. The ‘AE’ text string is still not showing in the pop-up. Thank you for your help.

var zonesubtype = $feature.ZONE_SUBTY;

When (IsEmpty(zonesubtype), 'AE - An area inundated by 1% annual chance flooding for which BFEs have been determined',

zonesubtype == 'FLOODWAY','Floodway designation of AE',

zonesubtype == '0.2 PCT ANNUAL CHANCE FLOOD HAZARD','X - An area determined be 0.2% annual chance flood hazard',

zonesubtype == 'AREA OF MINIMAL FLOOD HAZARD','X - An area of minimal flood hazard', '')

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Jay Hodny ,

Are you sure the field is null (empty) or does the field perhaps contains an single space or something not easy to detect? IsEmpty will correctly detect null values and empty strings, but not cases where you have a single string.

0 Kudos
JayHodny
Occasional Contributor III

Hi Xander,

I was beginning to suspect this may be a cause. I tried replacing the empty field records with (calculate field) but accidently messed up my feature class field. I have no restored the feature class and will proceed with more caution!

Thanks for your help,

Jay

0 Kudos