Hi, I've been searching around how to do this including the following:
https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051904
https://community.esri.com/t5/arcgis-online-questions/arcade-cancel-new-line-in-null-field/m-p/1190256
https://community.esri.com/t5/arcgis-online-questions/prevent-fields-with-null-values-from-showing-up-in/m-p/370113
https://community.esri.com/t5/arcgis-online-documents/hide-field-in-pop-up-using-arcade/ta-p/1029496
https://community.esri.com/t5/arcgis-online-questions/one-pop-up-expression-for-multiple-attributes/m-p/333376
My attribute expression in ArcGIS Online's new map viewer is as follows
var np = $feature.New_Patien return IIf(IsEmpty(np),"none",'Phone for new patients: ' + np)
However, it returns the 'Phone for new patients: ' even when the new patient phone field is empty.
Any help
Yes, a custom text element (attribute expression) and the new map viewer.
I'm assuming you're using the expression in a custom text element in your popup? And is this in the new map viewer, or the classic? The solutions vary depending on the context.
Hi, I will flag the first response as the solution. It solved the original issue. However, I am still seeing line breaks instead of null without a line break. Some of the links I referenced in the first post talk about taking care of line breaks in HTML. Does anyone have experience with that?
How about adding an additional condition and using the COUNT Arcade function to count the number of characters from the value returned? If the value is less than 2, treat it as a null condition.
This worked, thanks. (Where did those blank characters come from?!? 😉)
Not certain how to get it to not put a line break. Can that be done in HTML formatting, as some of the above links suggest? I switched to a NULL from "none", as below.
var np = $feature["New_Patien"] return IIf(np==' ',NULL,'Phone for new patients: ' + np)
I don't see anything wrong with the expression. Are you certain the fields are empty? That would be my first guess, that perhaps the field has strings which appear empty, but are a single whitespace character.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.