DataTable.select() versus FilterDataTable activity

datatable
studio
selection
filter-datatable

#1

Hello,

1)Can you please explain the difference between DataTable.select() and filter Data table activity ? When to prefer each and what is more efficient?, as of now I know one difference i found is return type.It would be great if you attach workflows for corresponding

2)And also how to use Datatable.select type for string type of columns in data table
I have given like this
image
getting issue
image

Thanks in advance.


#2

Hi.

I’m probably not the best to answer since I have not used the Filter Data Table all that much but have looked at it.

The problem I have with the activity is that you cannot verify and convert values during your condition phases. Like if you wanted to make sure the value is compared as a double, you couldn’t simply place in some syntax to say:
If(IsNumeric(row(0).ToString.Trim),CDbl(row(0).ToString.Trim,0) = value

Another problem I have with it is that you can only output to a DataTable, so if you want to process or update certain rows while keeping the original data table, you can’t really do that.

So,
I’d say the benefit you get from using .Select() is that you can be more flexible in what you are trying to do.

However, I still prefer the lambda method using .Where() for filtering data, and the coding is lot easier to understand… atleast to me. It accomplishes the same as using .Select() for filtering, but if you want to use all the vb.net methods like .Contains, .StartsWith, et cetera it’s fairly simple to do so whereas with the .Select() method for filtering you need to use different syntax. EDIT: Ideally, I would want an activity that is flexible like that where you can output to an array of rows or new data table, and also am able to place vb.net coding embedded in the activity on both sides of the comparison… or maybe there is a better way to make it user-friendly that can check if the value is a number and convert, etc.

The “Cannot find column” error is most likely happening because your data table was not read in with Column Headers or the Header does not exist. I would check the Read Range or Read CSV and make sure AddHeaders is checked. Also, using Output Data Table you can output the table to a message box to verify that the headers are there correctly.

Regards.


#3

Datatable.Select() is not an activity. It is a part of .net framework and returns an array of DataRow objects. It can used in any version of Uipath. While Filter Data Table is activity of UiPath and it is available starting with UiPath version v2018.2.x and its output is DataTable.


#4

Hi,

I am using build data table then using select , facing the same issue.
selectDemo.xaml (9.4 KB)

Issue:
image

Please help me on it, how I can resolve this issue

Thanks,
Karthik


#5

@karthik_bethi you have missed single quote in statement. Use following

dt.Select(“lastname=‘gautham’”)