ForEach Loop through DataTable in SAP

Hey Guys!

I am a novice working in SAP and am having some difficulties. I need to determine if each entry in the attached table:

  1. Contains “Yarp” in the Title column
  2. The value of the Status column is “Ready”

If both are True, I need to go through another workflow to process them.

I started by successfully extracting a DataTable and using a ForEach row in DataTable but got tied up on the syntax regarding how I would determine if the row had the above qualities. I believe one part would be row.Item(0).ToString.Contains(“Ready”) but I am not positive.

I also considered creating an array of all of the rows that were True, but realized it may be better to do a workflow something like:
-Extract DataTable
-ForEach row {Check Title and Status columns}
-If True = Process item workflow
-Else = loop back to next row

From what I’ve read, it seems like I can use a counter to loop through each row, one by one but I am not certain how I would do that.

EDIT: I am also going to be modifying the columns so that there is only one Status column as opposed to two.

Any help is GREATLY appreciated! Thank you all in advance!

I think the array of datarows is the better approach here. It can be done in less than a second with a single SELECT statement on your datatable.

1. Extract datatable // i'll call this dt1
2. Assign SelectedRows (this is a variable of type: `Array<datarow>`) = dt1.Select("[Status] = 'Ready' AndAlso [Title] like %Yarp%") // Note: This assumes yarp has a capital Y and lower case arp, and it can be found anywhere in the Title column (beginning, middle, or end)
3. Use a For Each activity and change the TypeArgument to Datarow. For each row in SelectedRows
3a. Do all of your processing within this for each loop

Okay, I see what you are saying! I really appreciate you taking the time to respond!
A few last questions:
-Do you think this would be a better option than using Queues to loop through each of the line items (rows)?
-If I were to use your method, I would need a way to double click each row from the SelectedRows in order to process. Each row has a unique identifier in the Title. What would be the best way to double click each of the rows while in my ForEach? Maybe assign each Title a variable and then double click on each variable in order to start processing?

If you are doing a significant amount of processing it is recommended to do it through a queue. This makes it easier to pick up where you left off in the case of exceptions. It also allows more than one robot to process all of the transactions.

You still use the select statement to return the array of datarows. In step 3a above, just add relevant information as ItemInformation to the queue item in the ‘Add queue item’ activity. The ItemInformation would have all the relevant info needed to process each individual transaction (such as Title)