I have an excel with sl no, Ui no, status, acc no, name, acc holder,
If I have two acc no’s same and acc holder is joint then I need to take any one data among those.
If I have two acc no’s same but one acc holder is joint and other acc holder is main i need to take only main data.
If I have two acc no’s same but one acc holder is main and other acc holder is joint i need to take only main data.
I need to write back the whole data back to excel.
You can use the Group by in the LINQ Expression to get the expected result,
→ Use the Read Range workbook activity to read the excel and store in a datatable variable called Input_dt.
→ Use the assign activity to write the below LINQ Expression,
- Assign -> Input_dt = (From row In Input_dt.AsEnumerable()
Group row By AccNo = row.Field(Of Double)("AccNo") Into Group
Let mainRow = Group.FirstOrDefault(Function(r) r.Field(Of String)("AccHolder").ToLower() = "main")
Select If(mainRow IsNot Nothing, mainRow, Group.First(Function(r) r.Field(Of String)("AccHolder").ToLower() = "joint"))
).CopyToDataTable()
→ Use the write range workbook activity to write the Input_dt to the excel.
Check the below workflow for better understanding, Sequence.xaml (12.3 KB)