Concatenating variable string while looping

I have some text to extract using get text activity. It stores the output in a variable string called ExtractedText. If let’s say on the first loop it extract 101, on the second 201, and on the third 301. I want to join these values on every loop into a single string like so: 101201301. Tried assigning ExtractedText = String.Concat(ExtractedText) but sure it’s wrong. So how to fix this?

Hi @private_matter

Create an extra string variable called “ExtractedTextResults”. Then use it like this:

ExtractedTextResults = ExtractedTextResults+“,”+ExtractedText

Then make sure the scope of the ExtractedTextResults is higher than the loop.

Also, the above will give comma separated values.

Hopefully this helps :blush:



Hello @Steven_McKeering

This works like a charm! Thank you for the swift answer.

But I have a question. Why is it necessary to have another string? What does the ExtractedTextResults do? If you can explain, I’ll be much appreciated.

1 Like


Its necessary to allow each result to be saved separately. Otherwise each loop the ‘Get Text’ activity will just override the previous ExtractedResult variable.
Loop 1: 101
Loop 2: 201 (overriding 101)
Loop 3: 301 (overriding 201)

Hopefully this helps,



Yes I see what you mean. I’m actually building a string array formatter where I can list multiple lines of text and then have them automatically converted to an array of string as such {“string1”, “string2”, “string3”} etc… I have many variables and this can be time consuming. Thanks for the support :wink:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.