How to get the rows which are having same data in excel need help

I have a scenario,
I have a excel
headers
PR IR SCODE M.NO …

1 10 345
1 30 345
1 40 567
2 50 567
2 60 567
2 70 567
3 80 345
. .
. .
HERE, for the PR and SCODE having same data then we need to add to the queue
send combinations line items to the queue like

queue item 1:

Scode: 345

PR: 1

Line Items: 10, 30

queue item:2

scode:567
pr:1
Line Items:40
like that hope u can understand(for the same scode and PR we combining line items and sending to queue)
@Gangadhar_Athili @THIRU_NANI @Gokul001

queuitem:3
scode:567
pr:3
lineitems:50,60,70

@saritha_panguluri
Just enable the unique reference for the created queue and add the reference as PR_Scode.
Then queue will not add the duplicate rows.

If you want to implement this in code, follow the below linq

New DT = Dt.AsEnumerable().GroupBy(Function(a) Tuple.Create(a("PR").ToString,a("Scode").ToString)).Select(Function(b) b.First).CopyToDataTable()
1 Like

DT.AsEnumerable.GroupBy(Function(r) Tuple.Create(r(0).ToString,r(2).ToString)).Select(Function(g) DT2.Rows.Add({g.First().Item(0).ToString,g.First().Item(2).ToString,String.join(“,”,g.Select(Function(r1) r1(1).Tostring))})).copytodatatable

image

Book1.xlsx (10.7 KB)

my reference excel, the columns should be like this exactly
when I am tried with above object reference not found issue coming, I think columns name not passing correctly, so can u please modify the formula with respect to the above excel file, need to complete today(in the above excel item of requisition means IR(line items))
@Gangadhar_Athili

if any one want to know the solution please check this thread

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.