1

I am experiencing an issue with the model only tool Calculate Value. I am attempting to use the Parse Path and Calculate Value model only tools to force a feature dataset into the Create Topology tool.

  1. The first parse path tool is taking the path
  2. The second parse path tool is taking the file (Feature dataset)
  3. The calculate value tool is combining the two strings and changing the data type to feature dataset using this expression ("%Path%"+"\%File%") (which will connect to the create topology tool)
  4. The problem is when combining the two strings, the calculate value tool is truncating a portion of the path name, specifically the number in the path name.

When running this model on a path with no numbers in it, it runs fine.

I also tried using the the calculate value tool again to replace the truncated characters with the correct ones, and still it breaks the model.

There is some issue with calculate value not accepting numbers in path names.

Can anyone help with this issue?

enter image description here

enter image description here

enter image description here

enter image description here

3

In Python, a backslash in a string always signals the presence of a special character. For example, a "\t" will be interpreted as a Tab.

I tested your "Calculate Values" expression in ModelBuilder with a path of "C:\Workspace\trash\temp.gdb\poly", and my result was "C:\Workspace rash emp.gdb\poly". Each "\t" was changed to a Tab.

To prevent python from interpreting characters after the backslash as a special character, add an "r" before the string. The version of the expression below calculated the correct string.

r"%Path%\%File%"
  • Thanks you. That does fix the issue in question, however it causes another issue down stream in my particular model. On the model that I mentioned I tested that does not contain numbers in the file path, changing the string to a raw string does not affect the model. (Still works fine) On the model that does contain the numbers in the file path, changing to a raw string causes the model to break further down the line than it was. Not sure why. Thank You for your help. – Michael B Jun 16 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.