[GIS] Changing name output with ModelBuilder Iterator

arcgis-desktopiteratormodelbuilderraster

I have several DEMs where I want to calculate their slope degrees.
I used iterate rasters with slope tool and I put %Name%_slope as Output Name.
The problem is the Name: it creates a file name too long ("dtm000628_slope")…
I would have slope rasters with name 335_%n%, but "%n%" doesn't work.
Do you know how I could change the name in an rasters iterators?

Here the model
**The solution is found:

In the output raster, %n% makes a sequential number in the file name of output rasters, but not if you start the file name with a number:

-Example 1:

in output raster = "C:\Output.gdb\335_slope%n%"

it will not work

-Example 2:

in output raster = "C:\Output.gdb\slope335_%n%"

it will work

-Example 3:

in output raster = "C:\Output.gdb\s335_%n%"

it will work

Best Answer

I think you are wrong with the naming convention of the arcgis featueclass, for details of naming convention get details at the Defining feature class properties of the Online Help.

According to these rules your featureclass name can not be started with numbers.

%n% means the loop number in the arcgis model builder.

So your intended name must be like string+(number)+%n% e.g. Test_%n%

Related Question