Linq query and filtration

Hi,
I have two data tables, one table[Dt1] with 5 columns with Invoice No( Index2 )and in another data table
[Dt2] I have 2 columns with Inovice No(index 0) and a Credit value(1).
If the Invoice No match then the credit value has to be written in dt1 without any interference with Dt1 data in Coloum6 and the row counts in both in both invoices differ.

via Linq only

Kindly,let me know if there’s a solution
As I am a novice in this its hard to comprehend.

Regards,
S Dharshan

Hi @sudharsan ,

Maybe we could first give a Try with the Join Datatables Activity. You could combine both the Datatables with a Key Value (Invoice), then filter only the Required Columns needed for the output.

Let us know if this does not suit your case.

Due to certain criteria, I cant use datatable activities…
hence linq queries :confused:

Regards,

Hey @sudharsan
(From d1 in dt1.AsEnumerable
Join d2 in dt2.AsEnumerable
On d1(“Credit value”).toString.Trim Equals d2(“Credit value”).toString.Trim
Let ra = d1.ItemArray.Concat(new Object(){d2(“col1”), d2(“col2”)}).toArray
Select r = dtTarget.Rows.Add(ra)).copyToDataTable

Hope this helps.

hi @Chirag_Shetty_Divakar
Will the creditvalue column be added to the dt1 as the 6th column?

I have two data tables, one table[Datatable_FilteredVlookup] with 5 columns with Invoice No( Index2 )and in another data table
[outdt] I have 2 columns with Inovice No(index 0) and a Credit value(1).
If the Invoice No match then the credit value has to be written in dt1 without any interference with Datatable_FilteredVlookup data in Coloum6

sry,made a error in the question
and
added a little more reference…

Regards,

Hi @sudharsan ,

Check this sample workflow attached below,
Uipath_LinqQuery_Filteration.xaml (13.6 KB)

Hope this may help you :slight_smile: