Assign DataTable cells to Variables

I am using the ‘Build Data Table’ activity to create a data table:

Now I need to store the username and passwords of the first row into 2 variables called ‘Username’ ‘Password
example: elephant123 is stored into variable ‘Username’, 123qweasd is stored into variable ‘Password’

Then, when it loops (I already created the loop), I need it to store the username and password of the second row into the same variables ‘Username’ and ‘Password
example: ‘test123’ is stored into variable ‘Username’, ‘2wsx3edc’ is stored into variable ‘Password’

and continue this until the loop ends (I already know how to end the loop).

How could I accomplish this?

Thanks in advance

Basically without using Row is you want to retrieve the value at a predefined position then this is what you can use. If dtTable is the Output DataTable of the activity.

dtTable.Rows(0).Item(0).ToString will give you ‘elephant123’
dtTable.Rows(0).Item(1).ToString will give you ‘123qweasd’. To continue for the 2nd Row, just increment the index under Rows.

If you are using For Each Row activity then,
row.Item(0).ToString will give you the value of the username for each of the iteration of the row.
row,Item(1).ToString will give you the value of the Password for each of the iteration of the row.

Let me know if it helps.

Rammohan B.

1 Like

I prefer not to use this method because my workflow is in a flowchart mode. And I am using decision boxes to create a loop. This way everything is separated and organized

How could I automatically increment the index under rows each time it loops?