Select to view content in your preferred language

calculate field for several fields in several tables

2262
4
11-19-2012 09:43 PM
PedroSoares
Emerging Contributor
Dear all,

I am trying to use the calculate field for several tables inside a GDB. These tables have a several common fields that should be fulfilled with the same info. Normally, using the batch for the calculate field, would do... however I want to try to do all the fields in one click.
is this possible?

I tried to use the iterator with tables... but no results.

any help would be very appreciated...

P

(sorry for my bad english)
0 Kudos
4 Replies
T__WayneWhitley
Honored Contributor
You could use the update cursor...a good way to access/change whatever field values you need to before moving on to the next row or feature (whereas the field calculator must finish iterating rows for a single field before moving on to the next field).
http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000
0 Kudos
T__WayneWhitley
Honored Contributor
Ah, but you say the fields exist in separate tables.  You can use either the field calculator or update cursor in a python script, but the thing here is, you can loop over a list of fcs you want to update the field for and run the same field calc.

You did not say if you needed this in modelbuilder, but I suppose the same thing could be accomplished with an iterator.  I have found usually this is just as quick and as easy to set up via Python and there are plenty of web help samples to follow, such as at the provided link last post for the update cursor.  Hope that helps.
0 Kudos
PedroSoares
Emerging Contributor
Thank you Wayne
I don't have any experience with python... although I am thinking to take a course.

With model builder I have been doing a few things... but normally the big challenge is when I need to use the iterator...
in this case the fields are the same for several tables and ... there are several fields.

Still need help. Thanks

P
0 Kudos
T__WayneWhitley
Honored Contributor
OK, what about this --
Do you think you can attach a sample of your data and what calculations exactly you want to perform - even if ithe sample is simply an 'empty' set of 2 or 3 fcs.  That way when someone sends you a sample solution you can implement it immediately with perhaps a few minor changes, then study it at your leisure later.
0 Kudos