Select to view content in your preferred language

Modelbuilder - Add and Calculate Fields

1215
3
05-30-2012 03:43 PM
J_Hatton
Deactivated User
Hello folks,

I need to construct a model that will iterate through a folder containing subfolders of shapefiles (NOT in a geodatabase), add a field to each of them, and calculate values for that field.  What I have constructed, instead, is a model that correctly adds the field to every shapefile but calculates the values for only the first shapefile.  The others are left with zeroes.  I suspect this is something quite simple, but I don't know what I'm doing wrong.  Thanks for your help!

Artemis
Tags (2)
0 Kudos
3 Replies
JonathanQuinn
Esri Notable Contributor
Can you share your model so we can take a look at it?  I assume you're using an iterator, such as Iterate Feature Class, (which will work with shapefiles), and then building your model off of that.  What values are you calculating into the field?
0 Kudos
J_Hatton
Deactivated User
Hello again,

I'm not sure what's the best way to show the model- I can't do a screen grab.  I'm attaching the zipped toolbox.

Yes, I am using Iterate Feature Class.  I have a bit of code in the Calculate Field tool that populates the field with sequential numbers beginning with 1.   It works a treat for that first shapefile.  I have also tried running the model with just the number 3 being put into that field, and again, it works for the first shapefile but the others remain 0.

The input variable is currently defined as a workspace, but I have also tried using "Folder" as the input variable and get the same result.

Thanks-
Artemis
0 Kudos
J_Hatton
Deactivated User
.......anyone?..................crickets...........................
0 Kudos