I am building a model in ArcMap ModelBuilder that will take an input dataset folder, iterate through each shapefile in that folder and use that shapefile as an input for another tool. I then want to base the output file name of the new tool to be based on the shapefile name used in the input (from the iteration). One of the restrictions for the output filename is that it must be less than 8 characters.

enter image description here

Can I use "%FeatureClass%" or something similar when putting the filename path in the output filename textbox?

enter image description here


Use Parse Path (Model Only) tool to get Name field of input rasters then use Calculate Value (Model Only) tool for truncating this value field to the desired length using python code block. then output of this tool should be preconditioned to your "3 VSECOM points to EC Raster" tool.

for example you need to select Name field in Parse Path tool it will output name of the raster (without extension) in Value model variable. then you need to write code block in Calculate Value tool as "%Value%"[0:8]. then set precondition to your tool.

you will get your 8 characters file name in output_value model variable. then you should use it as a output filename to your tool. ../%output_value%

  • I'll have to experiment with this in the future. It appears it would work well though.
    – gwydion93
    Mar 8 '18 at 22:00

This should answer your question.


  • This works using ../%Name% in the outputfile name. However, I should note that there is still a problem due to the char length restrictions for raster filenames (8 characters max, I think).
    – gwydion93
    Feb 21 '18 at 18:39
  • Huh, that is odd. I've not heard of that being a thing before. I am looking at several rasters in a GDB right now with names as long as 17 characters. It looks like you are saving to a folder, maybe try saving to a GDB instead? Or, it could be a parameter of the custom tool you are using? Just some thoughts.
    – Simon.y
    Feb 21 '18 at 20:54
  • OK, you are correct about the char limit for raster filenames. I just tried a longer name and it seemed to take without problems.
    – gwydion93
    Feb 22 '18 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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