Assign: The source contains no DataRows wiht Outer Join

Hi community,

I saw several similar threads here, but I could not find a solution to my issue.

I use the following command in order to find an outer join - entries that are not available in both DTs:

(From t1 In in_dt_availabeFiles.AsEnumerable() Group Join t2 In dt_processedFiles.AsEnumerable() On t1.Field(Of String)(“Vorhandene Dateien”) Equals t2.Field(Of String)(“Bearbeitete Dateien”) Into tg = Group From tcheck In tg.DefaultIfEmpty() Where tcheck Is Nothing Select t1).CopyToDataTable()

Sometimes it happens, that the entries coincide. Then I get an error message and my WF crashes. How could I prevent the bot from crashing?

Regards,
Slavisa

@sspi1153
currently not further checking your LINQ I am adressing with following on how to deal with empty returned result.

instead of CopyToDataTable shift to a toList and change the datatype of the receiving variable to List(Of DataRow) - YourRowListVar

on the next step useto an if activity and set the condition to: YourRowListVar.Count() > 0
for the true case: yourDataTable = YourRowListVar.CopyToDataTable()
for the false case: yourDataTable = in_dt_availabeFiles.Clone

let us know your feedback

1 Like

Thanks for the answer. Unfortunately, I am overwhelmed with another project at the moment. I will be able to check your solution only on Thursday and get back to you.

Thank you!

Hi again,
after schifting to list so that comand is:
(From t1 In in_dt_availabeFiles.AsEnumerable() Group Join t2 In dt_processedFiles.AsEnumerable() On t1.Field(Of String)(“Vorhandene Dateien”) Equals t2.Field(Of String)(“Bearbeitete Dateien”) Into tg = Group From tcheck In tg.DefaultIfEmpty() Where tcheck Is Nothing Select t1).CopyToList

i receive following error:

“CopyToList” is not member of "System.Collections.Generic.IEnumerable(Of System.Data.DataRow).

Thanks!

Give a try on toList instead of CopyToList