1

I'm using ModelBuilder to append a number of shapefiles to a single geodatabase. The shapefiles are located in a folder SHP and the model is designed to iterate through SHP, appending each .shp to the geodatabase. The model enters the name of the file into one of the fields of the geodatabase. Each .shp has very limited information attached to it (field names: FID, Shape, ID).

However, the geodatabase has many fields (Year, Name, Project, Type, etc.), some of which I would like to populate using parts of the filename; the filenames have a specific naming structure, for example: PRJ_YEAR_TYPE.shp, where PRJ is replaced with the name of the project related to the file, and similarly for YEAR and TYPE.

So far, I've been able to add the name of the shapefile to one of the fields of the geodatabase by:

  1. Adding a Field after I bring in my feature class (.shp) and
  2. Calculating the Field (named using one of the preexisting fields in the geodatabase), before appending the file to the geodatabase.

However, I'm not able to add mutliple fields. I've tried to duplicate the processes I used to place the filename into the geodatabase name field, but it doesn't seem to work.

How can I add the inforamtion going into the other fields (i.e. (Year, Name, Project, Type, etc.) making reference to the filename?

I am new to ModelBuilder.

1

If it were me I would process your folder of shapefiles then import the lot into your geodatabase. Doing it this way you can use an iterator to step through a folder of shapefiles. The output being the shapefile and its name then you enter a series of Add Field > Calculate. In the Calculate field tool you are using string functions to pull out the project, type etc.

I would search help for featureclass iterator, there are several examples to get you going.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.