3

I am using ArcGIS 10.1 for Desktop.

My goal is to create shapefile that contains merged feature classes from a geodatabase. I would like for there to be a new field in the resulting shapefile that contains the name of the original feature class. The tool that I have created is successful in merging the FCs into one shapefile however the "Name" field is blank for ever record.

The field that is intended to be populated is set up as a text field (length 50). I have set the "Name" variable from Iterate Feature Classes as a precondition to calculate field. My expression in Calculate field is "%Name%" with Expression Type Python.

What do I need to change to make this work?

Link to Image : https://i.sstatic.net/pUAnO.jpg

enter image description here

1
  • 1
    I think your model needs to include Parse Path.
    – PolyGeo
    Commented Sep 12, 2013 at 21:49

3 Answers 3

4

I followed the suggestion provided by @PolyGeo and I used the "NAME" component of Parse Path to populate Calculate Field. I connected the "Value" variable from Parse Path as a pre-condition to Calculate value. This solution was successful. This is what my final model looks like:

https://i.sstatic.net/thXlt.jpg

enter image description here

2
  • @PolyGeo - why is it necessary to use Parse Path - Parse Type:Name when this value is already available through the Name variable from the iterator?
    – Nxaunxau
    Commented Sep 17, 2013 at 12:15
  • @PolyGeo, I have the same question, when I used the iterator "Iterate Feature Selection", I was able to directly link the "Value" variable to the Field Calculator. gis.stackexchange.com/questions/64562/…
    – kkaszas
    Commented Sep 17, 2013 at 16:10
2

I was experiencing a similar issue with my iterating model. I was calculating a field in a series of tables to equal the names of the tables. I was left with blank fields. Since the data type is string, the expression needed to include quotes around the substituted variable, such as '%Name%' as opposed to %Name%.

With this change, the model worked as expected.

0

Your calculate field expression is ok. It should produce the intended result. I would modify the model so that the merge is done in a separate model that calls a sub model. Sub model copies features, adds and calculates field with feature class name, collects and passes the values to merge tool in the main model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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