I have 2 datatable same structure as attached file… I want to matching “Scope” Col between 2 datatable without loop rows if the “Name” Col is same value
Are LinQ or Join Datatable are possible do this ? And how to do this ?
Thanks in advance!
Apart from using join I think this query can help in
dt1.AsEnumerable().ToList().ForEach(Sub(row) row(“Scope”)= If(dt2.AsEnumerable().Where(Function(r) r(“Name”).ToString.Equals(row(“Name”).ToString)).Count<>0,dt2.AsEnumerable().Where(Function(r) r(“Name”).ToString.Equals(row(“Name”).ToString))(0)(“Scope”).ToString, Nothing))
Use this code in invoke code with dt1 as in/out argument and dt2 as in argument here
I am assuming that dt1 is Input Table
dt2 is Output Table
Hope it helps
Mark it as solution if it solves ur query
Actually I feel join isnnot needed here as ur need to update the value of scope column in input table from output table by look-up
If i want to add more condition to check same value at the “Position” Column as below picture, how to customize more in your code?
And i think it still must loop rows in your code… if two datatables have some thousand rows, it will take time to match same row between 2 datatables.
Is there any other way to match them without loop Bro ?
Well my code do the process of lookup and updating data too…
And then u can write dt1 directly into the excel itslef
Also can u explain more about how u need to consider position column too?
Thanks you Bro for your solution… i known how to customize to apply into my sample.
I will find more another way to compare the performance while matching 2 datatables can up to some thousand rows.
Is this method is taking more time than required?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.