Iterate DT For Each Group

Hi All, hope to get help on this:

  1. I have a DT in excel:

  2. For each same “Order”, I have to enter into this Oracle Java Screen

  3. Which will bring me to all the items under this Order, shown in this window:

  4. Then I Enter the quantity according to my datatable and submit/ save.

  5. Go to the Next Order and repeat Step 2).

I am stuck with how to “iterate” through each Order in sequence. Appreciate any help and guidance.

1 Like

Have you try to work on it? You can use excel apliction scope and use readrange ang forearo to iterate @COOLBOT


Yes, I have used Read range in Excel application scope. But what kind of " flow/logic" to process each Order in sequence?

your problem is somewhat similar to what i am looking as well. I can’t figure out how to “iterate” again after final step :frowning:

what you mean was you need to sort first the datatable before entering the value in oracle am i correct ? @COOLBOT

cheers :smiley:

Happy learning :smiley:


Sorting is not the issue because I can either sort in in Excel or in Uipath. I am stuck with how to iterate or the logic flow, treating each Order (with many items) independently and going to the next Order …….

Give a try on following

  • Retrieve the distinct values for Column Order (groups)
    Linq statement
  • Iterate over this groups
    for each, for each row
  • Filter for the group values
    Linq, Filter Datatable …
  • Do the entries for the group items

Thank you for outlining the process. As I have no knowledge of Linq, I suppose I would have to explore other methods .

Just tell us on which part of implementation you need more help and we will support you on this


Try this:

1 - Use Excel Activity + Read Range to make your DT

2 - Use For each row

Next Steps all inside the Use For each row

3 - Assing Order = row(0).tostring --> this will give you 1st order

4 - Assing Item = row(2).tostring --> this will give you 1st Item

5 - Assing LINE_NUM = row(1).tostring --> this will give you 1st LINE_NUM

6 - Assing Received_City = row(3).tostring --> this will give you 1st Received_City

Now you have all information stored in strings and ready to work

Use type into and use your strings make sure all are in same scope

For Each row will encrement all you rows in data table alone

Just a little starter help:

Readin the Excel into a DataTable - Read Range

  • e.g. Variablename: dtData - Assumption Column Order is of DataType: Int32

Creating a list of Groups (Distinct Orders) - Assign Activity

  • DataType Orders: List(Of Int32)
  • Statement: dtDemo.AsEnumerable.Select(Function (row) row.Field(Of Int32)(“Order”)).Distinct().ToList

Iterate over the Groups

Filter the original DataTable to all Rows belonging to the Current Group from Iteration - dtFiltered

Iterate over all Rows from dtFiltered

Create a variable to store OrderNumber = 0
For Each
If OrderNumber = 0 OR OrderNumber <> Row("OrderNumber)
-> This is new Order
-> Already opened window must just do details part

Hi ppr,

Thank you for helping me start it off. While I am beginning to understand the logical flow,
I am still facing a compilation error which I could not solve. Appreciate any guidance and advice.

RPA_1.xaml (11.5 KB)

the issue comes from following:
Datatype of your Variable Order is Int32 but should be as written above: List(Of Int32)

Hi @bcorrea and @COOLBOT,

This is what I was thinking too. No need to use LINQ if your Table is sorted.
Use a “While” to loop over all the rows and check at the end of the while’s body if the next row is a new “Order” or the end of the table.