Select to view content in your preferred language

ModelBuilder. Rename shapefile names using Iterator and CSV

06-23-2015 06:41 AM
New Contributor III

Hi, I had this idea, but I just can't figure out exactly how to execute it.

I have a model with an iterator that separates a shapefile based on the Numerical Layer in the attribute table. What I ideally need is to name the layers based on the physical Name of the layer that is not in the attribute table, so I created a "dictionary" using a csv file that contains two fields, the numeric layer name that is in the attribute table and the physical name I eventually wanted in the file name.

I just can't seem to figure out how to connect the two aspects of the model so it pulls from the data dictionary into the final file names.

Below is the model, and the CSV Table.

0 Kudos
3 Replies
Regular Contributor II

I believe the below image shows what you're wanting to accomplish based on what I've seen above. You'd just want to use a couple of pre-conditions and maybe a couple of inline variable substitution statements.

Examples of inline model variable substitution—Help | ArcGIS for Desktop


0 Kudos
New Contributor III

Thank you for your reply! I am having an issue where "Key" and "Name" keep changing back to "Value" and "Value 2" automatically,

EDIT: Nevermind I read about that in the provided Link.

0 Kudos
New Contributor III

I hit Assumed Answered by accident, I didn't know how to undo it.

I am getting this error

Executing (Iterate Feature Selection): IterateFeatureSelection C:\Users\morij\Desktop\Projects\M4Testing_062015\ModelTest\M4ExportMerge_LineWGS84.shp "Layer #" false

Start Time: Tue Jun 23 13:24:06 2015

Executing (Make Feature Layer): MakeFeatureLayer C:\Users\morij\Desktop\Projects\M4Testing_062015\ModelTest\M4ExportMerge_LineWGS84.shp I_M4ExportMerge_LineWGS84_Layer ""Layer" = 1" # #

Start Time: Tue Jun 23 13:25:45 2015

ERROR 000354: The name contains invalid characters

Item not found in this collection.

Failed to execute (Make Feature Layer).

Failed at Tue Jun 23 13:25:45 2015 (Elapsed Time: 0.09 seconds)

Failed to execute (Iterate Feature Selection).

Failed at Tue Jun 23 13:25:45 2015 (Elapsed Time: 1 minutes 38 seconds)

Here is How I fixed the model



0 Kudos