Using part of string as output name

4467
3
11-24-2014 08:09 AM
DavidCampbell
New Contributor III

Hi again all,

I have a model with an iterator. I want the name of the end output to be related to the input. The input name has many characters, most of which are of no consequence. The input names are consistent with (e.g.) XXX_NAMEiWANT_XXX. So I was wondering if there is a way to pull RIGHT( LEFT( %NAME%, 13) , 9 ) to the end file name. Where can I put this function to get my %name%?

Thanks

David

0 Kudos
3 Replies
DavidCampbell
New Contributor III

I imagine my answer has something to do with the 'Calculate Value' model only tool. I just don't know what to put in there.

0 Kudos
DuncanHornby
MVP Notable Contributor

David,

It is not clear which iterator you are using. So I've assumed you are stepping through a Layer looking at a field with you "names". The model below can easily be adapted if say you are stepping through a folder of datasets (thus a different iterator).

You can see in the pop up on the Calculate Value tool how I get to the name part you want. It is a simple text "slice" using python.

Untitled.png

0 Kudos
toddsams
New Contributor III

Check out the examples here:

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

0 Kudos