Convert a list to datatable

studio
variable

#1

Hi,
First time here:)
I have been trying to convert this list to datatable.
I am iterating through rows of excel and for each row i will get two values, ID and QTY and i would like to add those into a list where comma seperates the columns.

Would csv work better?
Thanks!


#2

Hi,

It depends on what you are wanting to do completely.
If you are iterating through the rows with a ForEach, then you can simply store the 2 columns into a new datatable, then use Write Range. At the start, you will need to create a datatable with the 2 columns using Build DataTable (or Read Range if it’s an existing file).

So pseudocode would look something like this:

Build Data Table to variable dtList
Read Range to variable dtProcessData
ForEach row In dtProcessData
Add Data Row activity to dtList with { row("ID").ToString,row("QTY").ToString }
Write Range for dtList

There are alternate ways to create your list as well, but I felt this idea would be simple.

I hope this is helpful and not confusing at all.

Thanks.