How to use contains in a select from datatable


#1

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)


Assign variables in Select
#2

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


#3

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


#4

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()


#5

@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?


#6

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


#7

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