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

Question

Question

iterating through dynamically created tokens

asked on April 15, 2015

I am using a sdk script action and parse out a CSV file and generate a multivalued token per row. 

I have two questions.

Because I am dynamically generating tokens per row of a csv file, what is the max number of tokens that can be stored per workflow session?

Also, Since I am generating an various number of tokens, can you nest a token in the name of another token?

example: %(row %(iterator))

That way I could use a repeat action to go though every token.

%(row 1)

%(row 2)

%(row ...)

 

Thanks

 

0 0

Replies

replied on April 15, 2015 Show version history

Maybe it depends on what you are trying to accomplish in the end, but my hunch is that you would have a far easier time using a Multivalued token, with each value of the token representing a row. This way, you can simply use a For Each Value activity to iterate through your one multivalue token. 

For example, call your MV token "%(Rows)" and simply iterate through the values with For Each Value, and each iteration of For Each Value will be a row. Much easier than using the Repeat activity =)

Your next question might be about how to create a multivalue token in the SDK Script. You might notice that the SetTokenValue function in the script takes an object as the value type (assuming C# here); you can pass a List<string> or an array of strings with your row values into the SetTokenValue function to create your own MV token in your script.

 

 

1 0
replied on April 15, 2015

There is no limit to the number of tokens. Though, if you plan on iterating through the rows/tokens, the more you have, the slower it will get. Dynamic token names are not supported, so nesting is not going to work for naming purposes.

If you don't mind my asking, what is the end goal of this workflow?

0 0
replied on April 17, 2015

Thanks for the replies. They were very helpful.

I am just playing around with the C# and the SDK. Flavio, you gave me some great things to think about . I appreciate all the help.

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

Sign in to reply to this post.