How to use contains in a select from datatable

I am trying to read datatable where the text coming from another source is larger than the data residing in my datatable. as a result we have to use a “contains” or starts with comparison. how do I achieve this? Attaching a sample xaml for explaining the issue. Please help. Thank you.test.xaml (8.5 KB)

Hi @dbiswas,
You can filter using the below code
DataTableName.Select("ColumnName like '℅value℅'").CopyToDataTable()

3 Likes

@dbiswas
you could also use filter data table activity! you’ll find a contains options there too!

Thank you for the reply. In my case the column is the string which is contained in the Text. Can I use something like the below statement?
DataTableName.Select("’"+InputText+"’ like ‘℅"+ColumnName+"℅’").CopyToDataTable()

2 Likes

@Rishab,
Much appreciate the help. It is good to note this activity. Its really useful. In our condition, the filter activity provides condition of “ColumnName Contains value”. In our case we need “value Contains ColumnName”. how can I achieve that?

So are you checking the column name alone not the column value???

I am checking the column name (not column value). And then fetching the column value for processing. Thanks.

Hello @dbiswas,

Just wanted to know if you found a solution to this?

I have a case where,
I have a description in one datatable , and I should verify if the same description is present in another datatable.
Also, the descriptions are not exactly same, so i should check for a considerable match between product description.

Do You have any suggestions?

Thank You!
Anusha

@Anusha_Makam

in your case try this (From x In dtPeriod.AsEnumerable() where (From a In dtPeriod.AsEnumerable() Join b In dt_calandar_datatable1.AsEnumerable() On cdate(a(“column3”)).ToString(“dd/MM/yyy”) Equals cdate(b(“Date”)).ToString(“dd/MM/yyy”) select a).Contains(x) select x).CopyToDataTable()

Hello @amaresan,

Thank you for the quick reply!
I dont have dates anywhere.

My scenario has :

I have two datatables as shown below:

Datatable1

Descriptions Amount
UiPath Studio 3000
Product- UiPath Robot 2000

Datatable2

Descriptions Amount
UiPath Studio product 3000
UiPath Robot 2000

For each description in DataTable1, I need to check if it matches Description in Datatable2 .
Like shown above, the record values dont match exactly. But these are the same products.

Can you please suggest any ideas to achieve this?

Thank you,
Anusha

This is not working

is there any solution for the original question?
i have same kind of question.
I have strAddr = 13, West st, Washington, TX 12345
In dt, i have street, city, state and zip seperately (seperate columns). I need to check this StrAddr contains with each column value. if any record matching all columns (i.e., Street, city, state and zip), then i need to go with that record.