How to get For Each Datatable Currentitem & Currentitem+1 at a time

I am trying to get Current item & Next value of current item from array at a time.
Can anyone please help.

my Purpose is to update A column value in From & B Column value in To textbox in app- at a time.

Hello @nilesh.mahajan ,

You are already using For Each CurrentRow in inputDT .So instead of using nested loop, just use Assign activities like:
PO_From = CurrentRow(“Start”).ToString
PO_To = CurrentRow(“End”).ToString

This will give you the values of both Start and End columns one by one for each row.

you mean you want the values of 2 columns at a time?

so if that is the case you can use the below expressions.

columnStartValue = currentItem("Start").ToString
columnEndValue = currentItem("End").ToString

@nilesh.mahajan,

There is a property index for For Each row in datatable activity. Just declare a variable of integer type and it will hold current row number being iterated.

Using below expression, you can get next row

yourdatatable.Rows(intIndexVariable+1)

Remember to add logic to check if the current row is not a last row as above expression will throw error while iterating last row.

Hi @nilesh.mahajan

You can define array and use for each activity, set argument to strong
Use Enumerable.Range(0, myArray.Length - 1) as the values to iterate through.
Then
Loop through
CurrentItem = myArray(index)

NextItem = myArray(index + 1
Try this use message boxes for your reference

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