Hi, I've been searching around how to do this including the following:
https://community.esri.com/t5/arcgis-online-documents/hide-field-in-pop-up-using-arcade/ta-p/1029496
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
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.
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)
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.
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?
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.
Yes, a custom text element (attribute expression) and the new map viewer.