Invalid field in model, but works outside of modelbuilder

102
1
01-13-2022 04:59 PM
ChrisCowin
New Contributor III

Hello,

I have a model I've built that takes a polygon feature class converts it to points and the reverse geocodes to get a postal address. The issue is that the Reverse Geocode produces fields that act oddly with modelbuilder; I wanted to concatenate several fields to produce a single string address with all data. When I run the expression:

" ".join([!REV_Street!, !REV_City!, !REV_Region!, !REV_Postal!])

It says that the field is invalid, but when run outside of modelbuilder as a single  Calculate Field geoprocess it works. How can I get the model to function?

0 Kudos
1 Reply
anbinh
by
New Contributor II

Hi,

I have tried in the model builder on my end (ArcGIS Pro 10.9.1), and it runs all good. Things I may have done a bit different from you if you did not mention or forgot to consider are:

  • I added "Calculate Field" into my model builder as the last processing step. For the configuration, I used "Python 3" as the Expression Type
  • If you also used "Python 3", then I think you need to have your expression as below (using bracket to format it as a "tuple" for Python 3 to join the fields, but not a "list". It may also help to click the fields from the list instead of typing them manually):
" ".join((!REV_Street!, !REV_City!, !REV_Region!, !REV_Postal!))

 

It did not have any issue with me, so hope it also works for you. 

 

Cheers,

 

0 Kudos