Column Filteration LinQ Error

Below mentioned LinQ is throwing error Can anyone suggest me how to solve it?

Assign Activity:

dt_output = dt_employee.AsEnumerable().Select(Function(x) dt_output.Rows.Add(x(“empid”),x(“empname”),x(“salary”))).CopyToDataTable

Error is mentioned in below Screenshot:

Hey @rajesh.rane

Welcome to @UiPath_Community

Just take one build datatable activity above assign activity & mention all the column you want as output.

You will get the expected output!

Happy Automation…!

Regards,
Ajay Mishra

1 Like

Thank you @Ajay_Mishra
its working Now :+1::+1:

Hi @rajesh.rane

You can use the below LINQ Expression, instead of using the Build Datatable activity.

Check the below expression,

dt_output = dt_employee.AsEnumerable().Select(Function(x) dt_employee.Clone().Rows.Add(x(“empid”),x(“empname”),x(“salary”))).CopyToDataTable

Hope it helps!!

Hey @mkankatala he want only 3 columns as a output not all columns!

Regards,
Ajay Mishra

1 Like

@mkankatala its working but its giving me all column name
so thank you for solution
but my error is solved using build data table activity

1 Like

Okay got it @rajesh.rane

If you want all the columns then you can use the above expression.

1 Like

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