Batch Updating attributes in Pro

4072
13
03-17-2021 12:32 PM
BrandonCraft
New Contributor III

I am trying to replace numerous attributes in a target layer from a source layer. The Transfer Attributes tool does exactly what I need on a single polygon at the time, but I need to do it on every record. The target has several fields that are not shared, but I need the rest to update. In our legacy workflow, I would have used an update query in the database itself, but within Pro is there any way to do this? There doesn't seem to be a batch option for this tool. 

0 Kudos
13 Replies
JoeBorgione
MVP Emeritus

Is python an option? I use a dictionary approach described here.

That should just about do it....
BrandonCraft
New Contributor III

Joe,

Python is definitely an option, but I was struggling to figure out how to go about it. Thanks for responding. That dictionary method could work, but the number of fields would make it pretty laborious. With other tools previously, I have modified them to run as a batch, but for some reason this one doesn't seem to do that.

0 Kudos
jcarlson
MVP Esteemed Contributor

Are the layers accessible via a Service, or are you working locally on file-based resources? The ArcGIS Python API may be helpful here, but mainly if you can take advantage of the edit_features function on a feature service.

- Josh Carlson
Kendall County GIS
BrandonCraft
New Contributor III

I'm working locally. Both layers are in a file geodatabase. When we used Personal Geodatabases, I would have just written an update query in Access. I am still developing the new processes, and this is one of the only issues left. 

I am fairly certain it will have to be written in Python, but it just seems like there would be a pre-built tool for it. 

 

0 Kudos
jcarlson
MVP Esteemed Contributor

Ah, boo. It would be a fairly simple matter if you could take advantage of Spatially Enabled DataFrames, but I try to stay away from ArcPy cursors as much as I can, we don't get along.

Do the records in your two tables line up on an attribute?

Could you: Create an ad-hoc join → batch field calculate the target attributes → remove the join?

- Josh Carlson
Kendall County GIS
BrandonCraft
New Contributor III

I haven't tried that since I moved them both into the same gdb, but the other day I tried doing it while one was a WFL, and it hard crashed Pro. I hadn't thought to try it again since I moved things around though. Good thinking.

JoeBorgione
MVP Emeritus

The whole point of the dictionary approach is to avoid a join.  I done it dozens of times on thousands of records/updates.  But do what you feel works for you.

That should just about do it....
0 Kudos
jcarlson
MVP Esteemed Contributor

I mean, the batch field calculator really wouldn't even need the join in place if the expression were written correctly. But I'll have to give it a shot next time a situation comes up that might need it. I'll never learn how to use the arcpy cursors if I keep avoiding them...

- Josh Carlson
Kendall County GIS
0 Kudos
BrandonCraft
New Contributor III

I agree Joe, but given that this is 114 fields on thousands of records just in this one example (more on other datasets), I probably need something the whole team can use and understand though. I would still like to find a more elegant solution. I'll update here if I find something.

 

0 Kudos