Hi-
I have a model using the 'Iterate Feature' tool. I am using the %Name% inline variable from the iterator to name my output files. The %Name% variable takes on the values "All_2014_06", "All_2014_07",.. etc. I would like to name my files with "Speed_2014_06", "Speed_2014_07", etc. instead... is there a way to alter the %Name% variable or only use a subset of the variable (the date portion) to do this?
Solved! Go to Solution.
I figured out the solution. You can use the 'Calculate Value' tool from the 'Insert'>>'Model Builder Tools' menu with the iterator 'Name' variable as an input. Adding the python script "%Name%"[4: ] will return the character string minus the first 4 characters. You can then use the result of the tool as your inline variable for naming.
I figured out the solution. You can use the 'Calculate Value' tool from the 'Insert'>>'Model Builder Tools' menu with the iterator 'Name' variable as an input. Adding the python script "%Name%"[4: ] will return the character string minus the first 4 characters. You can then use the result of the tool as your inline variable for naming.
It renamed the first file as 1 and took the name of first input file to rename the second file and so on.
Hi SUSHIL LAMICHHANE! I know this a really old post but I am experiencing this problem and wondering if you can help me? I have a model that creates a summary table for each unique record in a field. I am using the Calculate Value tool to remove spaces and other invalid characters from the %Value%; my output tables use %Name%. However, the name of the first output is "1" and the second table is what the first table should be and so on. Do you have a solution to this?
Robert, that is exactly how to do it! The only thing I'd add is if the variable you are using is a pathname (likely to have \ characters in it) you need to escape it, for example:
r"%Path%" + ".tif"