I'm not familiar with Arcade, but I'm trying to do a simple expression. I need to write an if-else label expression that will label addresses by their address number, unless there is a address unit number; then I would want the label to show the unit number. I've researched this documentation https://developers.arcgis.com/arcade/function-reference/logical_functions/ . I need a statement something like: If address is not Null than populate, or else populate unit number. I'm just not familiar with the Arcade structure.
FYI, You might have to use feature notation..., meaning it might be
iif(isEmpty($feature.addrunit),$feature.addrnmbr,$feature.addrunit)
Xander was correct because there were records in the field that had spaces, once I reclaculated the expression worked perfectly! Thank you for the expression Diana and thank you for the correction Xander!
Can you share your map?
Labels are a dynamic thing in ArcGIS Online. The features that actually get labels to show up will probably change as you zoom in & out, and pan around. At least that's been my experience.
Perhaps the field is not really Empty (Null) and contains a space or something similar. This could explain the behavior.
Hi Diana,
I'm still not getting the labels to display correctly. It is displaying only some of the ADDRNMBR's and some of the ADDRUNIT's.
Hi Nevin Valles , adding a reply to the same thread is the way to go. I'm sorry that I did not answer before, but the answer provided by Diana Lavery should be the way to go (if the field is really empty). Can you please try that suggestion? If it works, please mark her post as the right answer.
Try combining the "isEmpty()" and the "iif()" logic functions, which works similar to the if-function in Excel:
IIf( condition, trueValue, falseValue )
in your case, it sounds like it would be
Here's the Arcade Function Reference list for your reference:
https://developers.arcgis.com/arcade/function-reference/
Sorry, this is my first time using Geonet and I added a new comment rather than replying. I'm not to sure if you will receive a notification from my comment so i'm replying here.
I need the address numbers to display/label by default, unless there is an address for the unit. There can be many units associated to the one address and we need to display these. For example, a parcel with 10 units should display the 10 unit numbers as separate points, but there is still an individual point with just the address number that should be displayed as well.
Can you share how your data looks like and provide an example of what you would like to obtain for the different situations?
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.