How to use "NOT" condition in below LINQ

Hi All,

Below is LINQ, please advise me how to use not condition for the same query.

I want Opportunity ID from d1 which is not equal to Opportunity ID in d2

(From d1 In io_dt_PastClosedDate.AsEnumerable
Join d2 In io_dt_PastProposalSubDate.AsEnumerable
On d1(“Opportunity ID”).ToString Equals d2(“Opportunity ID”).ToString
Select d1).CopyToDataTable

Thanks in advance
Rushi

@ppr need help!

Hi @Athawale_Rushikesh

You can try with Join Data Table activity

image

Regards
Gokul

HI @Gokul001

Join Data Table activity is not returning correct records, instead few records are getting repeated in OP Data table.

Pleas suggest solution in the form of Linq.

Thanks

I don’t think so it is happening, Its Wired, Can you share the sample input excel file

HI @Athawale_Rushikesh

Check out this XAML File

ForumReference.xaml (6.9 KB)

image

Try with this expression

DtInput2.AsEnumerable.Except(DtOutput.AsEnumerable,DataRowComparer.Default).CopyToDataTable

Regards
Gokul

Hi @Athawale_Rushikesh

Join operator is to join two tables using a key (one column or different columns together).
I think what you want to do is merge, not join.

Join is always to get the rows from two tables with basis on a key.
Merge is to get all rows from both tables together in one table.

If you have the table, it would be easier to show you how to do that!

My first idea is to merge and then to delete the duplicate rows!

We do have 3 categories: Joining Data, hasMatch Check, Lookup Data when it is about bringing data together. Your case look like a hasMatch Check, where the result is denied.

Give a try at:

(From d1 In io_dt_PastClosedDate.AsEnumerable()
Let lid = d1("Opportunity ID").ToString().Trim()
Where Not io_dt_PastProposalSubDate.AsEnumerable.Any(Function (d2) d2("Opportunity ID").ToString().Trim().Equals(lid))
Select r = d1).CopyToDataTable

@ppr

Thanks as always for providing the exact solution :slight_smile:

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