Add multiline Matches collection to datatable

I want

Build Data Table 1: Field-Name, Value-?
Build Data Table 2 (output): Name-String

for each item in collection:
log item

Add data row to datatable 2 (output) column 0 (Name)

Save to an Array of Strings variable (or a regular list variable)

log variable after inserting names to column in datatable

Name: {Kie, Blake, Nicole, etc.}
Name: [Kie, Kay, Blake, Nicole, etc.]

Hi @Destiny_Malone ,

So you need to create another dt2 from dt1 by taking only name column and then create a string array of names as well?

If you have it in a collection, why would you save it to an array of strings variable or list variable? It’s already in a collection. Just For Each through the collection and use Add Data Row to add it to the datatable. In a Log Message you can just put String.Join(yourCollectionVar,“,”)

…or whatever delimiter you want to use if not comma.

Hi @Destiny_Malone

Follow the beloow steps and I hope it helps you solving the query.

  1. Create two DataTables say “dt1” and “dt2” and initialize the column names.
  2. Create an list and give the below condition

NameList(Datatype: System.Collection.Generic.List(System.String)) = New List(of String) From{“Kie”, “Blake”, “Nicole”,“Jake”}

  1. Run an For each loop for the above NameList Variable and use Add Data Row activity and add the names to the dt2 Datatable.
  2. Use Output Data Table activity to change the datatype and print it through log message.
    Note: Refer the workflow

Main.xaml (11.9 KB)

Hope it helps!!

That is correct. I need the string array of names to be saved to a variable that I will be passing to another workflow


Did you try this and did you get required output.

Trying now. I am unable to open the file though.

Try referring this. (3.1 KB)


Hi @Destiny_Malone

Assign nameCollection = {“Sarah”, “Blake”, “Kay”, “Kie”, “Nicole”}

Build Data Table:
Field-Name (String)
Value (String)

For Each item in nameCollection:
Log Message: “item”

Add Data Row:
DataTable: Second datatable
ArrayRow: {item}

Add to Collection:
Collection: outputList
Item: item

Log Message: “Name: " + String.Join(”, ", outputList)

Hope it helps!!

Quick question. The value is a Matches collection. Would it need to be looped through and saved to an array before I add to the data table?


yes, because it is of type,need to iterate through the loop to access the each item.


Matches collection means can you eloborate


If you want your match collection values as an array of string then you can use this directly

Matcol.Select(function(x) x.Value).ToArray