You are viewing limited content. For full access, please sign in.

Question

Question

Token Substitute Function in a Path

asked on January 16, 2019

I am trying to take an entry and move it to the exact same path, just with one part of it changed to something else. The way I am trying to do it is to take the path and run the substitute function, replacing the old value with the new one. However, the \ character seems to prevent it from working properly.

If the path is \Clients\Test\OLD VALUE\Rest of path

 

If I insert "OLD VALUE" as the value to replace, it will not work because it immediately follows a backslash. Note that if I insert "\Clients" then that does work, but I think it's because that's the beginning of the string.

 

If I insert just "VALUE" then that works. Regardless, I've tried a whole bunch of ways to escape the backslash and nothing seems to work. I bet there's a simple solution to this. Would I be able to get assistance on this?

Thanks,

0 0

Answer

SELECTED ANSWER
replied on January 16, 2019

It's the double quotes. They make the token a literal value. You also seem to have spaces in front of each token inside the double quotes.

1 0

Replies

replied on January 16, 2019

Can we get screenshots of how your activity is set up, please?

0 0
replied on January 16, 2019

Here is a screenshot of how it is set up and the result.

2019-01-16 10_47_30-Window.png
2019-01-16 10_47_45-Window.png
0 0
SELECTED ANSWER
replied on January 16, 2019

It's the double quotes. They make the token a literal value. You also seem to have spaces in front of each token inside the double quotes.

1 0
replied on January 16, 2019

I removed the quotes and now it says it's invalid. Also, I noticed those spaces in front of each token before, but when I removed them and click OK it put them back.

2019-01-16 10_57_35-Window.png
0 0
replied on January 16, 2019

That probably has to do with where you create the token in this workflow. Notice that it's still marked as invalid even when it's in quotes.

0 0
replied on January 16, 2019

Even with the token valid, it's the same behavior.

2019-01-16 11_55_47-Window.png
0 0
replied on January 16, 2019

Brian, I duplicated this outside of a for each loop and the substitute function is working without having to escape the slashes, so it must not be recognizing the original Old Path token outside the for each loop I'm guessing.  Here is the token calculator setup I used, with the resulting tokens in the middle:

 

0 0
replied on January 16, 2019

I took everything out of the loops and am still experiencing the same behavior.

 

I generated 3 blank tokens called Old Path, Token 1, and Token 2.

I then did SUBSTITUTE( %(Old Path), %(Token 1), %(Token 2))

It is claiming it is an invalid expression when I put

Old Path = \Test\Clients\OLD VALUE\test\abc

Token 1 = OLD VALUE

Token 2 = NEW VALUE

as test values.

0 0
replied on January 16, 2019

What version of Workflow? Have you tried running the workflow?

0 0
replied on January 16, 2019 Show version history

I'm not sure what is happening then, sorry Brian.  Even the exact tokens you posted there are working for me, is it possible when you put the quotes in there it messed it up and didn't go back correctly when you deleted them?  Did you try recreating the Old Path variable and the Token Calculator activity with a fresh Substitute function?

FYI I am on Workflow 10.2.0.216

0 0
replied on January 16, 2019

Without the quotes, it does appear to be working when I run the workflow even though when I try to test it says it's invalid.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.