How to iterate through a string array nested in a datatable

One of the columns in my datatable contains a string array (System.String) containing an unknown number of email addresses. I cannot seem to figure out how to loop through the items within this array.

I thought this would be as easy as looping through the datatable rows and looping through the items in the string array - but I’m clearly missing something…

image

It seems like it needs me to cast the column I’m attempting to loop as a string array, but I cannot find any information on how to do this.

Any help is greatly appreciated!

@MrCarder

arr_values=Split(CurrentRow(“Column2”).ToString,“,”)

use for each for arr_values

cheers

@MrCarder

Your type argument should be string

And in input argument try currentRow("notification_list").ToArray

I hope your datatype of the column is string array

If not then show the data how it looks we can convert to array or list as needed or cast to string for object

Cheers

we do have some doubts, but we assume that currentRow(“notification_list”) will return Object

When it is really a string array we can use within the second loop

DirectCast(currentRow("notification_list"), System.String() )

The “ToArray” method doesn’t seem to be supported. It didn’t appear in the intellisense menu and gives the above error when I type it out unfortunately.

1 Like

This worked! Thank you so much! I’ve already spent hours on this issue so your help is extremely appreciated.

In case it helps anyone in the future - this solution works when the loop’s TypeArgument is set to “Object”

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