Logic or LINQ required for below Question

Hi All,

Data 1 we received as CSV file format it is like data table and having 1L rows data.
like database
And we receive one input file we have coulmn ID,
from that input file we need to compare CSV file coulmn “ID” if it maches the id means we need to get Name column and save into excel

Note : CSV file contain lakh datas so should we go with LINQ

else vb.net code also please suggest.

I attached the screen shot for better understanding. (I created sample one)

Thanks,
Vicky

@Vicky_K

outputdt=dt1.AsEnumerable.Where(function(a) dt2.AsEnumerable.Any(Function(b) b(0).ToString.trim.Equals(a(0).ToString.trim))).CopyToDataTable

here dt1 is the CSV file and dt2 is Input File

Thanks.

Suppose i need to extract one more column in input means when id is matched what we need to add?

image

I need location and Priority from input sheet. (if ID match in Data 1 datatable)

@Vicky_K

use this expression in another assign activity below the above expression

finaldt=dt1.DefaultView.ToTable(False,"ColumnName","ColumnName2")

you can add columnNames which ever columns you want

1 Like

Thanks @Shiva_Nikhil

1 Like

LINQ is fast right comparing other?

@Vicky_K

Yes it is faster

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