1st For Each Row in a data table

Hello buddies. Please refer to the demo photo below first.

Column A, B, and C are input by me for the robot to perform some task and then the robot will record the running completion date in Column D. Please ignore Column B & C. At the beginning, the robot need to get the Info Number (if D2:D12 are all blank, that means the robot should get A2) as input for something else. After the task with respect to that Info Number is done, it will proceed with another task by getting the next Info Number. The information in that Excel sheet is accumulative.

My current workflow is to

  1. use the Read Range Activity for the DataTable
  2. use For Each Row activity to call the 1st number by coding Row.Item(“Info Number”).ToString

However, it will only begin with Row 2 if I use the current workflow. As this Excel sheet is accumulative, the robot should be learnt to realize the 1st row it needs is Row 13 in this case (as it is the first row that is blank in Column D), and run from Row 13 to Row 24.

What is the smart approach to achieve it? Thanks!

@wth1993
readin excel
filter out all rows where A and D is not empty (filter datatable Activity)
let the bot run with the filtered data

Or calculate index of first row (no empty A and D) and use a Skip(theOffsetIndex)

Thank you for the reply. Could you explain a bit more about how the 2nd solution works? (i.e. calculate index of first row (no empty A and D) and use a Skip(theOffsetIndex))

@wth1993
find general demo xaml here:
DTIteration_FindOffsetContinueWith.xaml (8.0 KB)

Thank you. I want to ask if I use Solution 1 (i.e. Filter DataTable), the corresponding activity to call the 1st row is For Each Row while for Solution 2 you provided, it’s For Each?

when iterating the rows from a datatable the for each row helps.
in my example I iterate over a list/collection of datarows. Thats why a for each was used.

Does this answer your question?

1 Like

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