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

Question

Question

How to use the split token function in workflow

asked on May 20, 2014

I am having trouble using the SPLIT function on a token in Workflow. I'm trying to take a comma-delimited list of names from a SQL query result and split each name into a multi-value token.

 

I have tried:

  1. Assign the value of %(ForEachRow_Names#@Split(/,)@#) to the token %(ListOfNames) within an Assign Token Value activity. I've used by replace existing values and append values options within the activity.
  2. Run a For Each Value loop on %(ForEachRow_Names#@Split(/,)@#). Within the loop, append the current value to the %(ListOfNames) token.

 

Neither of these is giving me a multi-value token. Instead %(ListOfNames) is still a string of names and commas.

 

What am I doing wrong? 

Thanks in advance.

0 0

Answer

SELECTED ANSWER
replied on May 21, 2014

Kenny, I can reproduce the issue and it looks to be a bug. I filed it into our bug tracker and we'll investigate it.

 

It seems to be isolated to tokens from Data activities. As a workaround, you can an Assign Tokens in For Each Row that assigns the token from Query Data to a token. Then use the split function on that token instead.

 

1 0
replied on May 21, 2014

Thanks, Miruna.

 

I'll use the workaround you provided. I guess it must not be common to get a delimited list from a query result.

 

Is my name attached to all the bugs I'm finding in 9.1.1? Do I end up on some kind of hall of fame wall? smiley

1 0

Replies

replied on May 21, 2014

Couldn't you just pattern match the pattern you are looking for, then change the return value to "All matches (as a multi-value token)", then assign as needed?

5-21-2014 7-57-40 AM.jpg
1 0
replied on May 21, 2014

Darrell,

I tried using a pattern match, but it has not been successful. The list looks something like this:

First M. Last, Sally Jones, John C. Doe II

 

I haven't been able to come up with a pattern match that works consistently.

Also, the split seems like less work.

 

It looks like Miruna verified that the split breaks for query results.

0 0
replied on May 21, 2014

you should simply be able to use the function to split the token on "," and then assign that changed token to the new token you want to have that multi-values for. You do not need to use a loop, but rather, just an "Assign Token Values" activity and assign a new or older token to be the token you are separating with the function mentioned above applied to it. It's a little counter-intuitive, but it does seem to work in all my workflows just fine.

 

You can also use Pattern Matching to create a multi-value token, but it might be a little messy to configure and get the first or last item in the pattern match input token. That's why I would recommend the much easier way I mentioned above.

1 0
replied on May 21, 2014

I also tried that, but added removal of the comma after the split in the same "apply function" for aesthetic purposes. smiley

0 0
replied on May 21, 2014

That may not be completely necessary as the split removes whatever  the split criteria is. 

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

Sign in to reply to this post.