Dt.asnumeranle() problem

datatable
studio

#1

Hello , I was running my robot which read data table and do some filters , all was ok until my robot strat to show this mesagge:

Manage FileV1 has thrown an exception
Source: Assign11
Message: The source contains no DataRows.
Exception Type: InvalidOperationException

it’s like this table does not have information after the filter but I have already chexk this :slight_smile:

this is my code DT_Dist.AsEnumerable().Where(Function(row) row(“Key_2”).ToString=row1.Item(“Key_2_D0”).ToString).CopyToDataTable() and i have this in a assing equal to a other data table, please help,it is important to say that the other variable is a data table.


#2

Hi @diegotamayo,
Use equals instead of “=”

DT_Dist.AsEnumerable().Where(Function(row) row("Key_2").ToString.Equals(row.Item("Key_2_D0").ToString)).CopyToDataTable()

Regards,
Arivu


#3

Hello, thanks I have the same problem , its posible us a invoke code for this function


#4

can you send me the xaml file i can check and update you @diegotamayo


#5

You are getting “No datarows” because the filter found no rows that match, therefore the .CopyToDatatable fails.

You might need to use .ToArray() instead of .CopyToDatatable, cause it will stil work but just give you a .Count of zero. You could probably do that first, check if it found any rows, then Assign the .CopyToDataTable after.

Hope that helps.

Regards.


#6

hello i cant atah the file could yoy give me a email


#7

Hello, thanks, I have checked that the result is greatter than zero, but the fucntion still wrong, I will try with array


#8

If you’re getting zero rows found after the filter and there shouldn’t be, then we’d need to check the condition with the equals.

I would ask what does row1 represent. I’m assuming it’s inside a For Each and it’s from another table.


#9

this does not work and I can upload the xaml couse I am new


#10

screenshots work to (like using Snipping tool), if you can’t upload.