How to Filter Data Table

Cool, you can replace “A(.)-(.)B” with something like the below
“Bread(.)-(.)butter”
or to ignore case:
“[bB][rR][eE][aA][dD](.)-(.)[bB][uU][tT][tT][eE][rR]”

Thank you…

Just wanted to ask. The Filter Data Table is not available in my activities. But the UiPath.Core.Activities package is installed properly. The available activities for me only under the data table is Build, Clear, Generate, Merge and Output.

Thank you for answering.

Hey @ClaytonM

I applied below syntax for filter data table , But getting error , Please let me know any another alternate please

Image5

Hi.

where you have vMainDT.Select(), change that to vMainDT.AsEnumerable
Although, I’m not sure it will make a difference.

If the column does not exist, then make sure that vMainDT has the column (you can check it with Output Data Table activity then show the string in a Message Box or Write Line). Keep in mind, if the file does not exist, the Excel Scope will create an empty Excel file with no column names.

Other than that, your syntax looks good.

You can try using lambda expression, which is basically the same thing.
That would look like this:

vMainDT.AsEnumerable.Where(Function(row) row("Division").ToString.Trim.Equals("07") ).CopyToDataTable

Regards.

Got it,

In read range activity I for to check the Headers option

1 Like

Hello All, I’m trying to filter an excel sheet with three columns and then Im writing to another excel sheet.
But filtered data is not getting written into new excel sheet. I’m attaching .XAML file, please suggest.ExcelPractice2.xaml (16.6 KB)

Hi @nikhil_rao,

In write range click add headers & try once
no need of using for each row,directly you can give filter data table output in write range

Some minor edits:
dt2 = (From row In dt1.AsEnumerable() Where row("ColumnName").ToString.Equals("") Select row).CopyToDataTable()

Hi Dear,
You can use Activity Filter Data Table

image

Thanks!

3 Likes

I am using filter data on one of the excel file and want to use the filtered output (one of the columns) to filter in another datatable (another excel). Can i use all the filtered output (A1, A2, A3…) to filter in another all at once?

You can do that. If you are more detailed in your question with an example input and output of what you need, and what you have tried, I can help further.

Regards.

Sure. I have a three excel files, one has state names (State), another has various locations (Locations) that are active in that state and third has the Asset details (Asset) in that location. I want to use each state name in the ‘State’ excel to be filtered in locations excel first to get the active location and then use all the active locations to be filtered in Asset Excel. So that i can get the Asset details per active location. (These three excel files are standard and cannot me merged together).

I have been able to filter the data using for each State and get the active locations for each state, but I do not understand how to filter all the active locations (multiple locations) at once in the Asset Excel. I tried storing the filtered locations to a Data row variable but not sure how to proceed further.