I'm using model builder to iterate through feature classes in datasets. With each sucessive process step (each model) I'm using the %Name% variable to name new feature classes in a new dataset.
I found that I can't just use %Name% without adding a little to the name of the new feature class; the model didn't seem to like working with two feature classes with the same name. To write the new feature classes to disk, I'm using something like %Name%_AppendedBit. The problem is that with sucessive steps I keep adding more and more bits to the name of the feature class.
I tried using Calculate Value with something like Replace(%Name%,_AppendedBit,_JustIdentifyThisStep) to make a variable with which to name the new feature class, but %output_value% doesn't appear to have any value (just "1"). I tried this as a variant and as a string. I was using vb Replace in the "expression" box, not messing with the "code block" box.
I could use %n% to name the feature classes, but then I lose useful detail from the original feature class name. This could be worked around by doing a spatial join later.
So, the long and the short of it is I'd like to use some kind of string truncation with inline variable substitution.