Fetching the values associated with the Unique Column Value (Group by)

Input:

Reservation ID Amount Code
NJMPDBHW 56 7992
NJMPDBHW 78 7991
NBPPBQFN 90 7992
NBPPBQFN 94 7991

Output

Reservation ID Amount Code
NJMPDBHW 56, 78 7992, 7991
NBPPBQFN 90, 94 7992, 7991

Reading_the_UniqueReservationIDs.xaml (36.3 KB)

Have a look here and get introduced into the different options:
[HowTo] Overview on different options for grouping data and processing the groups - News / Tutorials - UiPath Community Forum

1 Like

Hi @Nissy_Ruth_Prabhu

Can you try the below

Code:

(From row In dt.AsEnumerable()
                              Group row By ReservationID = row("Reservation ID") Into GroupedRows = Group
                              Let Amount = String.Join(", ", GroupedRows.Select(Function(r) r("Amount").ToString()))
                              Let Code = String.Join(", ", GroupedRows.Select(Function(r) r("Code").ToString()))
                              Select ReservationID, Amount, Code
                             ).ToList() _
                             .Select(Function(x) dt.Clone.Rows.Add(x.ReservationID, x.Amount, x.Code)).CopyToDataTable()

Input:

Output:

Regards,