Linq giving error

Hi Team,

I have written the linq and an error is occuring. Is it due to the datatable which is obtained after the linq is null?

After the Linq, the Original_DT may have been empty i guess. What is the solution for this?

@yash.choursia

use this query in place

array_dt=dt.AsEnumerable.Select(Function(r) r(“InvoiceNo”).ToString).where(Function(x) not VL02N_List.Contains(x.ToString)).ToArray

use if condition as

array_dt.count>0

then

array_dt.copytodatatable

else

use log message

1 Like

check using below code in
if condition
OriginalFile_DT.AsEnumerable.Any(Function(x) Not VL02N_List.Contains(x(“InvoiceNo.”).ToString))
Then part keep the assign activity
OriginalFile_DT.AsEnumerable.Where(Function(x) Not VL02N_List.Contains(x(“InvoiceNo.”).ToString)).CopyToDatatable
Else
Log message or steps to follow if there are no rows matching your condition

Hi, please check variable Original_DT has data or not and check column names are correct.

Hi @yash.choursia

Check out the thread

Video : https://www.youtube.com/watch?v=ioxPUw_PxMk

You can also try with Try Catch activity

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