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

Question

Question

Token Calculator Substitute function creates an extra space, keeping the function from working with tokens

asked on September 25, 2017

I cannot get the Substitute function to work correctly when using tokens for parameters.  When I pass hard coded parameters, it does work correctly.

 

When using hard coded (input, old, and new) parameters of "Input_Test_Input", "Test", "Substitute", the substitute formula properly returns "Input_Substitute_Input".  But, when I pass each of these parameters as token values, the input parameter is found, but the old and new parameters are not found, leaving the input value "Input_Test_Input".  If I hard code the input and old parameters, and only pass the new parameter as a token, the result is "Input_ Substitute_Input".  There is an extra space inserted before the new parameter.  Going back, if I pass all three values as tokens, but include the extra space in the original string as "Input_ Test_Input", then the function works, although the result is of course "Input_ Substitute_Input".

 

Why do the old and new parameters, when passed from tokens, include a space at the beginning?  Is there any way to prevent this from happening?

0 0

Answer

SELECTED ANSWER
replied on September 25, 2017

The activity looks fine in a quick test:

 

Are you sure you don't have an extra space in the value? Please add screenshots here or have your reseller open a case with Tech Support and attach a workflow that can reproduce the issue.

1 0
replied on September 25, 2017

I found out what the problem was.  I tested this from the "test formula" link in the Token Calculator dialog box.  When testing values, I received an invalid expression error.  I did not advance my testing to actually running the workflow since the dialog box test was failing.  (If I had, it would have worked correctly, and I would have been confused.)

I found that by placing the tokens in quotes, this "fixed" the invalid expression error, but caused the extra space error I was seeing.  But I had placed the quotes around the token references themselves in the formula, i.e SUBSTITUTE("%(paddedVal)","%(old)","%new").  Surprisingly, this actually works, and even pulls in the token values, but with the extra space.  I see now that I should have placed the quotes around the test token values themselves after clicking on test formula.  This also prevents the invalid expression error and makes the formula work correctly, without the extraneous space.

I suppose I thought that since each token was already set to type=string, I did not need to specify the quotes, which is what led me down the path I went down.  It is working correctly now, however, thanks to your reply.

Thank you for the assistance!

0 0

Replies

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

Sign in to reply to this post.