Solved - Getting a single value from a DataTable using a Counter Variable

I’m trying to get a single piece of data from my data-table and assign it to a variable to use later in my process. However, the single piece of data is determined by my Counter variable. I’ve been trying to use the Get Row Item activity using: DataTable.Rows(Counter).Items.(mycolumn) and have been unsuccessful. I’ve tried to set my Counter variable to a data row type instead of an Int32, but that screws up my Assignment activity.

I’m thinking there’s a way to use an if statement within my for each loop to grab the piece of data and assign a variable to it.

Something like:

If data row = Counter, then get row item (data row) , but I’m not sure how to do this and there are no conversions for int32 to datarow

Or is there a way I can extract the actual number out of the counter (where it meets a previous if statement condition) and plug that into the get row item activity?

Really needing some help on this.


You can use any of the below assign statement,

Using Column index

String_data = yourDT.Rows(Counter).ItemArray(0).ToString

Using Column Name

String_data = yourDT.Rows(Counter)(“column name”).ToString



Thanks @ranjith, it worked! I appreciate the help!

1 Like