Select to view content in your preferred language

Model builder: Add join --> Calculate field used to be very easy. Did something change?

375
2
11-06-2024 12:14 PM
Labels (2)
AZendel
Frequent Contributor

I've been using model builder for over 2 decades now -- back to the days of ArcMap 8.x.  A very common workflow is to join a 'standalone table' to a feature class and then use the Calculate Field tool to either transfer values from the table or perform actual numeric calculations across both tables. I've done that probably 100s of times over the years and it used to be easy in model builder. When you'd open up the Calculate Field tool, the list of fields where you could specified the target field would be listed as FeatureClass.Field or Table.Field. This appears to still happen most of the time, maybe all of the time (see blue highlight below). Then you could double click fields in the area circled in green to start building your calculation expression. 

AZendel_1-1730921364126.png

But now the fields from the joined table aren't even listed in the green list any more. But I remembered that with Python, the expression would be !tablename.fieldname!. When I type that by hand and click the verify button (green check mark circled in purple above) it doesn't report any errors or problems. But when I run the tool, it fails.

OK, so let's try Arcade instead. Since the fields from the joined tables are listed in the fields list, we have to guess the correct syntax. Based on how it used to work with VB expressions and python expressions, I've tried:

  • $feature.tablename.fieldname  (not accepted)
  • To try to be in sync with the python expressions, I've tried $feature!tablename.fieldname!. That didn't work either -- and I didn't expect it to. 

I'm still on Pro 3.0.3 due to some compatibility issues with our county's ArcGIS Server. Was this a bug in 3.0.x versions of Pro? Is it fixed in newer versions? If not, does anyone have suggestions?

I'm aware of the "join field" tool and I'm using it as a work around for now. When you're just transferring values from one field from a joined table to the feature class, it only requires one step and therefore it's actually easier. But not necessarily if you're trying to repopulated a field that's already in the 'target' feature class or table.  And it's not easier when you're doing arithmetic across both tables such as (featureclass.field1 + jointable.fieldX) * jointable.fieldY. It's also not faster in my current need: I have a stand alone table that I need to populate with X, Y coordinates from several 2 feature classes, meaning I have to do 2 joins. And this is what I get when I do that with the Join Field tool:

AZendel_3-1730923992165.png

 

So now I have to

1) Select by Attributes where X is Null

2) Calculate Field twice, one to transfer X_1 to X field, one to transfer the Y_1 to the Y field

3) Delete the unneeded X_1 and Y_1 fields. 

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

fixed in 3.1

BUG-000153592 for ArcGIS Pro


... sort of retired...
0 Kudos
JenaHBG
Emerging Contributor

I'm experiencing something similar. I have a model with an add join to copy over x y values  from a point feature, that way I can have center point values added to my feature service. I was using calculate field during the add join, then removing the join in the model. Only now I get error 000013, mentioning I cannot add values to an existing field.  Sadly, they note the bug as not reproducible.

I'm sure 'm not the only one experiencing this loss in workflow. 

I've also experienced an issue with variables. Previously I could use the date as a variable in the model so I could insert %namemydate% into files names backups. This was working just fine last year.  Now I have to change a single character in the variable prior to running the model and in the model chain to get it to work. I'll save but then the issue is the same. It is absolutely frustrating and mind boggling. I suspect they don't have enough model builder users on their end to know when they break functionality. 

0 Kudos