I’d like to filter the row if the cell contents contains various value.
Is it possible to filter like this? Please refer to below example.
Current status is I can filter with specific keyword with below script! (Had some helps from this forum :))
(from x as DataRow in Dt2_HSBC_001 where x(“Name”).ToString.Contains(“Joy”) select x ).CopyToDataTable
The problem is key words are multiple like below(Iist is stored in excel file)
So, If target row contains one of key word among this excel list, I’d like to remain.
[Process]
validate with ‘keyword excel file’ whether the row contains keyword or not
Only remains the rows which contains keywords.
It’s a bit complicated,so please let me know if you need further information !
Thank you for helps always !!
@prasath17 Hello, Thank you for your reply
Faced below error message. do you know what is the root cause of it?
Stored keyword list on ‘Dt_keyword’
and assigned in array with 'St_Arr_keyword
Dt_keyword.AsEnumerable().Select(Function (a) a.Field(of string)(“Name”).ToString).ToArray
Additional Q is how to read the column with above code?
I stored column data to Datatable variable and using Assign activity to convert String Array.
Is there another way?
Read KeyWord Excel into one datatable(KeyWordDT) and convert it to Array of Keywords as below KeyWordArr=KeyWordDT.AsEnumerable().Select(Function (a) a.Field(of string)("Column Name").ToString).ToArray
Read target excel into Datatable (InputDT).
Assign ResDT=InputDT.Clone
Use below expression in assign activity.
ResDt=(From row in InputDT.Asenumerable
Where KeyWordArr.AsEnumerable.Where(Function(x) row("ColName").ToString.Trim.Contains(x.trim)).Count>0
Select row).CopyToDatatable()