Skip to main content
3 of 3
added 2 characters in body
jbalk
  • 7.6k
  • 1
  • 18
  • 41

This code splits the path at "". To return the last x part(s) of the split path, use the following code in 'Calculate Value' as the expression. Leave the code block blank. Set output type to string. To get the last part of the path, change x to 1. To get the last 2 parts of the path joined with "_", change x to 2. (e.g. C:\string1\string2\string3 -- x=2 yields "string2_string3" and x=1 yields "string3")

"_".join('\%Value%'.split('\\')[len('\%Value%'.split('\\'))-x:])

To use this in your model, it will look like this: %output_value_c%_%name%

jbalk
  • 7.6k
  • 1
  • 18
  • 41