In-line Variables in ModelBuilder

3805
4
11-17-2015 09:29 AM
DarrochKaye
Occasional Contributor

Hi folks,

I'm playing with a ModelBuilder tool that I want to use in-line variables to specify the location, e.g. %Location%_sm_10k is my desired output file name. However as this is a grid, it cannot be more than 13 characters.

When I run the tool, I'm getting the error that the file name is more than 13 characters. However when I enter 'drum' as the variable, that would make 11 characters. Even if I enter 'd' as the location, I get the same error (#000161), so I can only assume it is picking up %Location% as part of the file name? I'm a bit lost!

Any help would be greatly appreciated!

0 Kudos
4 Replies
DarrenWiens2
MVP Honored Contributor

Try saving as a .tif, which doesn't have the same naming restrictions. That way, you may be able to determine whether it's a problem with your file name (doesn't look like it), in-line variable substitution (maybe?), or something else entirely (probably?).

ChrisDonohue__GISP
MVP Alum

I think Dan Patterson is on to the reason - the in-line variable substitution is including the path besides the filename, so thus too many characters.  As suggested in the links Dan posted, the Parse Path tool in Modelbuilder  can be used to separate out the name from the path.

Parse Path—Help | ArcGIS for Desktop

Chris Donohue, GISP

0 Kudos
DarrochKaye
Occasional Contributor

Hi,

I don't think that's the answer to my particular problem. My variable is a user-defined string which I want to insert to the beginning of the grid file name. I've attached a diagram to try to illustrate better (the only input which is not shown is the input polygon shapefile). When I run this I get a generic Error 9999 model failure. Since my original post I have changed Location to LOC and this has sorted out the number of characters issue, so I must be missing something as the model was treating the entire %LOCATION%_sm_10k string as the file name, which is obviously over 13 characters.

Inline_Variables.png

I'd rather not change to a TIF as this needs to be in grid format, and now that it runs the number of characters isn't an issue.

Thanks for all your help thus far.

0 Kudos