List Variable into Datatable column

Hello, I need to store a list variable myList= [x,y,z] into a datatable column in the list format.

Inside the add data row activity I am passing myList to the corresponding column. However the result is:

System.Collections.Generic.List…

I was expecting to add my list with its values inside.

Is there any way to do this?

Thank you!

@ycoledeandres

Welcome to forums

You can use For Each activity and then you can place add datarow activity

This way you can make List to Datatable

Thanks,
Srini

But I don’t want to iterate through my list, I want to add the entire list with its content in LIST FORMAT to the datatable columns.

Thanks though

Hi @ycoledeandres ,

Can you display your expected output in the data table after you insert [x,y,z] ?

Regards,

@ycoledeandres ,
Can you please confirm how you want the output?

image

Or this?
image

Regards,

1 Like

Columns 1, column2, column3

-------, ---------, [x,y,z]
-------, ---------. [a,b,c]

So column3 will store lists.

second one but has to be in list format with its {}

@ycoledeandres ,

You can add the list to the data table but, however, you won’t be able to display it unless you access it by indexing the element.

And make sure that the column type is also list of strings

image

Regards,

1 Like

@ycoledeandres ,
Check this workflow is this what you want?
ListToDataTable.zip (2.3 KB)

Output:
image

Regards,

And do you know how to iterate through the list while iterating through the data table.

So for each row in DT
For each item in currentRow(“column3”)

this is printing again the system.collections thing instead of the values inside the list.

Thank you!

@ycoledeandres , You need to convert it to list :

CType(CurrentRow("Column3"),list(of string))

image

Regards,

That was great! Thank you! Was trying to do .toList bust was not working!

10/10

1 Like

Glad that i could help.

Cheers @ycoledeandres

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