For Each String in a DataColumn

Hi, how do I loop through all the Strings in a DataColumn using a For Each activity?

ForEach (stringVar) in (colVar)

where stringVar and colVar are the String and DataColumn variables respectively

Need to extract the String collection from colVar

@DEATHFISH

Do you mean want to iterate one by one row from DataTable ?

Hi,

I suppose we cannot extract each content from DataColumn variable directly.
So if your data is from Excel, perhaps you should use Read Column activity. (it returns IEnumerable<object> variable)
Or get list of content as list<string> using the following expression in advance.

list = dt.AsEnumrable.Select(function(r) r(colVar).toString()).ToList()

Regards,

2 Likes