0

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

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 21, 2018 at 17:14

2 Answers 2

2

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%

answered Mar 8, 2018 at 4:36
1
  • I'll have to experiment with this in the future. It appears it would work well though. Commented Mar 8, 2018 at 22:00
0

This should answer your question.

http://desktop.arcgis.com/en/arcmap/10.3/analyze/modelbuilder/examples-of-inline-model-variable-substitution.htm

answered Feb 21, 2018 at 17:37
3
  • 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). Commented Feb 21, 2018 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. Commented Feb 21, 2018 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. Commented Feb 22, 2018 at 14:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.