Tuesday 15 January 2019

arcgis desktop - Using Feature Class "Name" from Iterate Feature Classes to Calculate Field with ModelBuilder?


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 : http://imgur.com/R0h4U78



enter image description here



Answer



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:


http://imgur.com/cYnbBvb


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...