I have a ModelBuilder tool with an iterator that splits a feature into multiple shapefiles based on a attribute field. The problem I'm running into is instead of simply using the number values for naming, I would like to replace the number with what the layer physically represents. For example a few of the new shapefiles are




I would like these to be named respectively




And there are quite a few more that need renamed in that fashion. The problem is there is only layer numbers in the attribute table and nothing represents the physical name except for the legend. Here is the model I have so far [Model][1]


1 Answer 1


This seems like something that should be very easy but requires an extra step.

The solution I came up with is to create a dictionary.csv file in excel containing a "Key" (layer #), and a string (name).

Use the table select tool to select rows from the dictionary where the key is equal to the layer #. This will output a new table containing only a single row. Next, you can use the model only tool "Get Field Value" to get the "string" field from the table, which can then be used in your file name.

  • OK, I will try this. It will take a bit because there are about 450 layers! Thanks!
    – GravitaZ
    Jun 22, 2015 at 21:06
  • OK I got the dictionary done, I did the tools that you recommended, but I'm having trouble figuring out how to get the values from the dictionary table into the iterator function. New Model i.imgur.com/RRZsdZm.jpg and example from dictionary table. i.imgur.com/2kDt299.jpg
    – GravitaZ
    Jun 22, 2015 at 22:00
  • You should be able to use the variables enclosed within % signs within your file names. You should rename the variable "Value (2)" to something like "Name". The input to table select for the key should then be %Value%, and the name of the file output by copy features should be M4ExportLine_Layer%Name%.shp
    – BruceDoh
    Jun 23, 2015 at 12:39
  • OK I tried that, I'm sorry maybe I'm not getting something right, I'm rather new to modelbuilder. I got an error ERROR 000210: Cannot create output C:\Users\morij\Desktop\Projects\M4Testing_062015\ModelTest\FinalExportByLayer\M4ExportLine_Layer%Name%.shp ERROR 000354: The name contains invalid characters Failed to execute (Copy Features). Failed at Tue Jun 23 09:13:02 2015 (Elapsed Time: 0.05 seconds). It seems like the Value (2) keeps changing it's name back to Value (2) from "Name"
    – GravitaZ
    Jun 23, 2015 at 13:14
  • Interesting. Not sure why it keeps changing its name back. Have you tried making the file name: M4‌​ExportLine_Layer%Value (2)%.shp
    – BruceDoh
    Jun 23, 2015 at 13:21

Your Answer

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

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