Inline model variable substitution

5322
12
Jump to solution
03-28-2012 08:33 AM
BillTrask
New Contributor II
Is it possible to use the inline model variable substitution when the input is a list of variables?  I would like to be able to select a number of input soil shapefiles, clip each according to the same clip features, then name each resulting clipped soil shapefile according to its original input name. 

I've made a general input feature (to be clipped) called 'Soil', set it to parameter and a list of values.  I've parsed the name of 'Soil' and set the output variable from here as 'SoilName'.  Finally, I use inline variable substitution for my clipped output feature by calling it 'Clipped_%SoilName%'.  When I run the model, I input 2 features to be clipped: the soils shapefiles of Herkimer County and Montgomery County (in that order).  When it's finished running, I only get the clipped Montgomery County with the name 'Clipped_Herkimer'.

I know that there are other methods of inline variable subing, such as the %i% option, but in this case the name is essential because I will be using this later in the model to perform a table join with each County's massive soils table.  Any thoughts?
0 Kudos
12 Replies
PapantzinCid
New Contributor III
Hello All, I know this is an old thread but I am facing a similar issue.  I am using ArcGIS 10.1 and am trying to export clipped datasets to a new file geodatabase.  I tried using both the iterator method, the list of values, and the batch parse path method.  I want to keep the same file name but change the output location.  When I specify the new output location I use %Name% so that the original names will transfer over to the new output file geodatabase.  When I do so I get the following error for both methods:
Start Time: Thu Feb 14 21:16:23 2013
ERROR 000210: Cannot create output C:\Users\Desktop\SanDiegoData\Output.gdb\%Name%
ERROR 000354: The name contains invalid characters
ERROR 000354: The name contains invalid characters
ERROR 000354: The name contains invalid characters
The table was not found. [%Name%]
Failed to execute (Clip)
When I try the same process without changing the geodatabase output location and name (the output automatically add the  _clip) it works fine.  Any suggestions?  Am I using the wrong Wildcard/In-line Variable?  As mentioned by someone else.  It is essential that I keep the names the same and I would prefer to use the list of values method so that I can bring files in from different locations.
Thank you in advance for any help you can offer.
0 Kudos
curtvprice
MVP Esteemed Contributor

The table was not found. [%Name%]


I highly recommend you focus on using the iterator method; multi-values are a bear to work with.

I don't see where you are populating a Name variable. If the variable does not exist, it gets put into your tool arguments unmodified.

The normal way to get that value is to use the Parse Path tool as described above in this thread.
0 Kudos
PapantzinCid
New Contributor III
Thank you.  After speaking to several other people they also suggested using the parse tool.  Thanks so much for the reply!
0 Kudos