Value of type '1-dimensional array of System.Data.DataRow' cannot be converted to 'System.Data.DataRow'

Hi everybody, I am working in the foundation course of the UI Path and try to select from CSV to Data row and get the following error
Compiler error(s) encountered processing expression “SampelData.Select(“Age<40 And Income>40k”)”.
Value of type ‘1-dimensional array of System.Data.DataRow’ cannot be converted to ‘System.Data.DataRow’.
Kindly help

3 Likes

Hi @aadam

the select-statement returns an aaray of data rows as there could be more than one row matching your select.
So please change the data type of your variable you are assigning the select to to an array of system.data.datarow

5 Likes

Once you get the data from the CSV to a datatable, if you perform a datatable.Select on the datatable you have, it will return a data row array. So to hold the filtered results, you should have a variable with the type data row array (DataRow).

Additionally, if you want to hold the results of the output just like a datatable, you can add the below code segment to the end of your select command.

DataTableVariable.Select("YourConditions").CopyToDataTable
3 Likes

thanks a lot for your kind support

Thanks a lot for your kind support

1 Like

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