Hi Team
I need support for comparing two rows in same data table
in two collumn first is invoice and second is Status.the issue is if one invoice number status is fail then for same invoice number in second row the status we need to make fail
please help to resolve
thanks in advance
Could you show the output you would like to get?
Cheers
in sr no 4 invoice no is 71 and status is failed
in sr no 5 invoice no is 71 and status is failed it should change to failed
same for sr no 6 invoice number is 74 and status is failed to
from sr no 7 to 11 status should change as failed
Example solution
Tester.xaml (12.6 KB) Test.xlsx (8.3 KB)
-
read excel
-
create list of unique invoice numbers
-
create a dictionary.
a) Then for each unique invoice, check if the table contains a row with that invoice where status = fail,
b) if a row is found, then add entry to dictionary where key = invoice, value = fail,
c) otherwise add entry where key = invoice, value = success
-
update datatable with new values from dictionary
-
write new dt to excel
result
(left = original excel, right = result excel)
Thank you so much for support
i am facing one more issue while comparing
Assign: Specified cast is not valid.",
an alternative method using LINQ and Lambda expressions
Step 1/ get InvoiceNr of records with failed status
Step 2/ update source DT
OuterJoinAndReplace.xaml (8.2 KB)
dt.xlsx (8.3 KB)
Cheers
can you send me the excel you are using if its still not working?
General
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.