I have 2 datatables DtA and DtB and want to fetch the records exists in DtA and not in DtB. I have more than 30000 records in both the datatables. I used linq except query to fetch the records but it is finding case sensitive records also as non match. Could anyone help me which join in uipath can be used?
@Boopathi Can you try this and Check :
In_DataTable1.AsEnumerable().Where(function(row) Not In_DataTable2.AsEnumerable().Select(function(r) r(“yourColumnName”).ToString.Trim.ToLower).Any(function(x) x = row(“yourColumnName”).ToString.Trim.ToLower).CopyToDataTable()
Hi @Palaniyappan Thank you. Left join returns all the data from the DTA and matched records in DTb correct then how it can return only exists in DTa and not in DTb. Left join not returning expected data
Hi @supermanPunch Thank you. I am trying your query. Could you please clarify the function syntax as it displaying Select(function r(“yourcolumnname”)
Thank you. I am able to get the desired output using an another linq query but now new error is coming as unable to case system.double to system.string. Could you please check and given below the code
DT1.AsEnumerable().Where(function(row) Not DT2.AsEnumerable().Select(function(r) r.Field(Of String)(“ID Number”)).Any(function(x) x = row.Field(Of String)(“ID Number”))).CopyToDataTable()
Fine
Make sure the column type is string or if not use .ToString along the column here in this expression
And
I hope this expression would help you [quote=“Palaniyappan, post:8, topic:195801”]
DtA = DtA.AsEnumerable.Except(Finaldt.AsEnumerable,DataRowComparer.Default).CopyToDatatable()
[/quote]
DT1.AsEnumerable().Where(function(row) Not DT2.AsEnumerable().Select(function® r(“ID Number”).ToString).Any(function(x) x = row(“ID Number”).ToString)).CopyToDataTable()