Process the same order on an excel

Hello Everyone,

I want to extract data from an excel file and then process it.
For example start processing with the same order of column A
i.e. process each line of order 0017013435 line 2,3 and 6
and then do the others
I have already done the read range part and the for each but I don’t know how to go about getting the same orders and doing the following
How can I manage
Thanks in advance
image

@kaj
can you give a screenshot of the result what shoud be


@kaj try this

image
image

Like this separate in other datatable

Hi @kaj

  1. Read Range: Use the “Read Range” activity to read the data from the Excel file and store it in a DataTable variable (let’s call it dtInput).
  2. Group Data with LINQ: Use a custom code in an “Assign” activity to group the data based on the values in Column A (Order Number). Here’s the LINQ query to achieve this:
Dim groupedData = From row In dtInput.AsEnumerable()
                 Group row By orderNumber = row("ColumnA") Into Group
                 Select New With {.OrderNumber = orderNumber, .Rows = Group.CopyToDataTable()}

In this LINQ query, ColumnA should be replaced with the actual name of the column in dtInput that contains the Order Numbers.

  1. Process the Grouped Data: Use a For Each loop to iterate through the grouped data and process each group accordingly. The groupedData variable will contain a collection of groups, and each group will have an Order Number and a DataTable containing all the rows with that specific Order Number.

Hope it helps!!

Hello Pravallikapaluri :slight_smile:

I tried to do what you said but I can’t really do it a bit complicated

what i did may be wrong
Thanks in advance

image

Hi @kaj

Try this way:

  1. Use “Read Range” to read data from Excel and store it in a dtInput.
  2. Use “Sort DataTable” activity to sort “dtInput” based on the values in Order number.
  3. Initialize a variable “currentOrder” to store the current order number being processed.
  4. Use a “For Each Row” activity to loop through each row in the sorted DataTable.
  5. If(currentOrder = CurrentRow(""number order)) Then perform any necessary actions to complete processing for the previous order.
    Else: Update “currentOrder” with the order number of the current row. Process the current row based on your requirements.

@supriya117

Hi,
I tried to do something, but I’m not sure
is this how it should be done
Input_RPA2 - Copie.xlsx (9.8 KB)
GetTransaction.xaml (14.4 KB)

@kaj

The data got sorted by number order like you want.
Please explain want do you want to do in the next process?

On the current excel file they are sorted in order but there may be cases without sorting
the goal being to process for example the same codes then come back to process the following ones always the same codes so on until the end

@kaj

So we are using sort datatable activity to sort at first.
I am not able to get it, could you please explain by taking example.