Array DataRow cannot be converted to DataTable

I have this assignation:

After that I have a For Each Row

When I execute this sequence appears this:

"Compiler error(s) encountered processing expression “filteredRows”.
Value of type ‘1-dimensional array of System.Data.DataRow’ cannot be converted to ‘System.Data.DataTable’.

What can I do?

You were almost done
FOR RACH ROW can take only datatable as input
But when select method is used it gives us array of datarow
So just a small change
All with that expression
Use a assign activity before to the for each row loop and mention like this

*yourdatatable = Yourdatatable.Select(“expression”).CopyToDatatable()

Mention the CopyToDatatable
Then mention that datatable name in for each row loop

Cheers @Natalia_Lozano

1 Like

Appears a Runtime execution error:


What he says is to Add .CopyToDatatable after your sampleData.Select(“vvvv”) assign…

1 Like

@Natalia_Lozano ,

"Object reference not set to an instance of an Object " - This error comes when something is not defined and trying to get value out of it.

In your workflow what i can observe is that , you are using foreach with array of datarow. Instead you should convert it to datatable and then you can use…
For converting datatable – sampleData.Select(“Age <40 and Income>40K”).CopyToDatatable you can use.

Still i have attached one sample for your reference, have a look…

Arrayofrowtodatatable.xaml (9.1 KB)
Test Excel.xlsx (7.9 KB)


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