recently started LINQ in uipath and i need to copy a specific column and all that values from that column to a new datatable. May I request for a sample code please
i tried this code DTEPI.Select(“retro lookup”).CopyToDataTable however throws error
Hey, @VicP! Only solutions via link solve your problem?
Because in this case there is a very simple alternative with the “Filter DataTable” activity. Just take a look!
→ I have this worksheet and I want to get only the “Origin” column.
→ I’m going to Read this table and use the “Filter DataTabel” activity.
Note that in the “Read Range” activity I read the table in the previous figure, from which I would like to extract only the “Origin” column and stored it in the variable “dt_test_1”. In the “Filter DataTable” activity I put “dt_test_1” as the variable to be filtered and as a result of the filter the variable “dt_result”.
→ Let’s look internally at the settings for this activity. I only configured the “Output Column” tab, selected the “keep” option and left only the index of my column of interest.
→ To check the result of the workflow, I wrote the filtered DT in another tab of the worksheet.
→ The result was this!
If you specifically want a solution using LINQ or other advanced filtering methods, let me know and we’ve come up with a solution for that!
Use this LINQ query to get the specific column values.
- Read Excel → Output - dtSheet1
- Assign Activity →
dtBillColumnValues (Type - Datatable) = dtSheet1.Select.CopyToDataTable().DefaultView.ToTable(False, “Bill”)
(Bill → Your Specific Column Name)
Hi, Thank you for this steps. Actually I’m using this steps as well and trying to test an alternative approach like LINQ because of the amount of data that I’m processing. I noticed processing of data is much faster using LINQ. by the way this helps a lot appreciate your help! Cheers!
Thank you for this one. this is exactly what I need. thanks a lot for your kind support.
Please mark as solution if its resolved your problem.
You should mark my above post / First post as Solution.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.