Arcade Expression for Mailing Labels in Public Notification Widget

1711
14
Jump to solution
06-01-2020 06:53 AM
KellyArmstrong
Occasional Contributor II

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
1 Solution

Accepted Solutions
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.

View solution in original post

0 Kudos
14 Replies
XanderBakker
Esri Esteemed Contributor

Hi OakdaleGIS ,

Could you try this?

if (IsEmpty($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;
}
0 Kudos
KellyArmstrong
Occasional Contributor II

Xander,

It works great.  Only issue is after the concatenation, the elements have no spaces between them...

Thank you very much!!

0 Kudos
KellyArmstrong
Occasional Contributor II

Xander,

It does work.  I was just seeing the concatenation in Arcade, when I actually utilized the expression, it worked with spaces.

Many many thanks!

0 Kudos
KellyArmstrong
Occasional Contributor II

Xander,

Actually, now that I have used/called the expression in the "Public Notification" widget, it does not function:

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi OakdaleGIS ,

Could you look at the actual content of the building number field where you see this behavior? I am using the IsEmpty function and when the field is not actually empty it will not work. If the field is string, please check that there are no spaces in this field, since it will not be detected as empty. 

0 Kudos
KellyArmstrong
Occasional Contributor II

I am not finding any spaces.  How would you check?  Also, this is a service from our ArcGIS Server, not a hosted feature service from AGOL.

0 Kudos
MichaelVolz
Esteemed Contributor

Do you have access to the datasource of the AGS service to review the raw data in ArcMap/Pro to look for blanks?

0 Kudos
KellyArmstrong
Occasional Contributor II

Yes, the service is located here:  Service

field:   parcel_building_number ( type: esriFieldTypeString , alias: /\BLDG_NUM/\ , length: 10 )

0 Kudos
KellyArmstrong
Occasional Contributor II

I don't see any spaces...

0 Kudos