Select to view content in your preferred language

Arcade Expression for Mailing Labels in Public Notification Widget

2199
14
Jump to solution
06-01-2020 06:53 AM
KellyArmstrong
Frequent Contributor

Here are my fields:  [building_number], [street_name], [street_type], [street_direction], [city], [state]

I am trying to create an expression where, if the field [building_number] is empty, don't show any fields.

Else, return something like this:

Resident

[building_number] [street_name] [street_type] [street_direction]

[city], [state] 

0 Kudos
14 Replies
XanderBakker
Esri Esteemed Contributor

Hi Kelly Armstrong ,

Thanks for sharing the link, but it seems that the server is not responding. Also thanks for confirming that the field is indeed string. The problem with spaces is that they are difficult to detect visually. If there is a space we could use Trim function to strip them from the field before testing if it is empty. That would change the expression like this:

if (IsEmpty(Trim($feature["building_number"]))) {
    return "";
} else {
    return "Resident" + TextFormatting.NewLine + 
    Concatenate([$feature["building_number"], $feature["street_name"], $feature["street_type"], $feature["street_direction"]], ' ') +
    TextFormatting.NewLine + $feature.city + ", " +  $feature.state;
}

If indeed there is a string this could resolve the issue.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi OakdaleGIS ,

Can you confirm that you used the exact same expression that I posted? If I look carefully at the result below, it would mean that the expression is executed only partially, since there should be a blank line between "RESIDENT" and ", MN".

0 Kudos
KellyArmstrong
Frequent Contributor

Thank you.  It works great in a popup, but when using it with the "Public Notification" widget, I get this:

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi OakdaleGIS ,

This is due to the fact that the newline is not supported yet. This will come in the near future.

0 Kudos
KellyArmstrong
Frequent Contributor

Any update on this?

0 Kudos