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

Question

Question

Use token to generate number of rows in csv file

asked on October 23, 2014

I am trying to write a csv file based on tokens generated in a retrieve field values workflow step. I have successfully done so by hard coding it.

However, I have a “count token” that counts the number of values in a multi value token. I would like to take the number in the “count token” and use that as the number of rows in the csv file. For example, if the “count token” has a value of 2, there would be 2 rows of data in the csv file.

Appreciate any response. Thanks.

1 0

Answer

SELECTED ANSWER
replied on October 23, 2014

From your code, I think the easiest thing would be to just make another token outside your script to count the number of values in one of your multivalue tokens that would correspond to your row count:

Assign Token Values -> "RowCount" = %(YourMultiValueTokenName#@Count@#)

You can set this up using the token dialog and applying the ValueCount function to whatever your input token will be.

After that, just add the following variable in your SDK script:

Dim numRows As Integer = GetTokenValue("RowCount")

You should then be able to loop over all the rows and adjust the indexing of your multivalue tokens in your TokenReplace() function. Just to give a concrete example for one of your values, you would need to modify it to look like this:

TokenReplace("%(RetrieveFieldValuesfromExpenseClaimForms_GL Code_All#[" & For_Loop_Index & "]#)")

 

1 0

Replies

replied on October 23, 2014

There's a token function for counting how many values there are in a multi-value token. You can then use that number in a For loop in your script.

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

Sign in to reply to this post.