[GIS] Concatenating string data plus numeric data in ArcMap field calculator

arcgis-10.2arcgis-desktoparcmapfield-calculatorpython-parser

I am using ArcMap 10.2.2.

I have three attribute fields (Address_No: 1, StreetName: Main, Street_Ty: ST) that I want to merge together. How do I concatenate string data found within the table plus numeric data?

I would like the following result: 1 attribute field – Address: 1 Main ST

Best Answer

No need to write a function here. Just hit the Python radio button, and then write this into the box:

 Address: + " " + str(!Address_No!) + " " + !StreetName! + " " + !Street_Ty!

What is important:
- field names are represented by their name but embraced by exclamation points: !
- any numeric field needs to be converted to a string when concatenating with other strings. To do that in Python, use the str() function. Anything within the parentheses will be converted o a string, even if it is a number
- You should add blank characters (" ") between your parts, to format this nicely, so it appears like: Address: 1 Main ST instead of Address:1MainST

Related Question