Concatenation Help

507
4
Jump to solution
10-19-2023 08:55 AM
analyzethis25
New Contributor II

Hello everyone,

I am needing some assistance with writing a concatenation. I have a "label" attribute field that is currently "null".

Example.JPG

I need to concatenate the fields from other columns into the "label" column.

Individual Columns:

Address

Pre-directional

Street

Street Type

 

I need to concatenate these individual columns to read as a full address in the "label" column.

I have tried several times, and while the expression I write will validate, I also get an error when I try to run it.

I am currently using ArcGIS Pro 3.1.3

 

Any help you all could provide would be greatly appreciated.

Thank you!

0 Kudos
2 Solutions

Accepted Solutions
jcarlson
MVP Esteemed Contributor

In Arcade, you can use the Concatenate function with an array of the items you want joined. Specifying the separator, in this example, an empty space, will result in that being placed in between each value of the array.

var fields = [
  $feature.field1,
  $feature.field2,
  $feature.field3,
  ...
  $feature.fieldN
]

return Concatenate(fields, ' ')

 

It's also possible to filter that array so that null entries are skipped. If you have some addresses with or without units, pre/post directionals, etc., it can be nice to avoid extra whitespace.

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
JasonBagwell1
New Contributor III

 

JasonBagwell1_0-1697738229031.png

 

Where you would calculate using your field names.

Concatenate($feature.Address, ' ', $feature.PreDirectional, ' ', $feature.Street, ' ', $feature.St_Type)

 

 

View solution in original post

0 Kudos
4 Replies
JasonBagwell1
New Contributor III

The error could be caused by concatenating a string with an integer.   

 

0 Kudos
JasonBagwell1
New Contributor III

 

JasonBagwell1_0-1697738229031.png

 

Where you would calculate using your field names.

Concatenate($feature.Address, ' ', $feature.PreDirectional, ' ', $feature.Street, ' ', $feature.St_Type)

 

 

0 Kudos
jcarlson
MVP Esteemed Contributor

In Arcade, you can use the Concatenate function with an array of the items you want joined. Specifying the separator, in this example, an empty space, will result in that being placed in between each value of the array.

var fields = [
  $feature.field1,
  $feature.field2,
  $feature.field3,
  ...
  $feature.fieldN
]

return Concatenate(fields, ' ')

 

It's also possible to filter that array so that null entries are skipped. If you have some addresses with or without units, pre/post directionals, etc., it can be nice to avoid extra whitespace.

- Josh Carlson
Kendall County GIS
0 Kudos
analyzethis25
New Contributor II

Thank you so much! These solutions worked perfectly. Exactly what I needed.

0 Kudos