Can we use Wildcards for Column Identification

Please assist!
Is there any way to use Wildcards or LIKE condition to validate Data table columns?
E.g. There’s a column “Telephone Number” and I want to apply filter but I’m not sure what’s the name of the column but I know It’s going to start with “Telephone”

1 Like

@Codegias
have a look here:

and here:
https://www.csharp-examples.net/dataview-rowfilter/

you will get the sample:
Operator LIKE
dataView.RowFilter = “Name LIKE ‘j*’” // values that start with ‘j’
dataView.RowFilter = “Name LIKE ‘%jo%’” // values that contain ‘jo’
dataView.RowFilter = “Name NOT LIKE ‘j*’” // values that don’t start with ‘j’

Also the filter Datatable activity allows you to configure a filter expression with a startswith, contains condition

1 Like

Thanks @ppr,
Can I use same approach for Column names also. I mean instead of Assign activity I’ll use Filter data table and there I’ll pass LIKE in column field, would this approach work

here I would suggest to iterate over the columns with a for each and check with yourColumnLoopVar.ColumnName.StartsWith(…

or do it with a LINQ:
Using an Assign Activity:
left side: ColName (String)
right side:
YourDataTableVar.Columns.Cast(Of DataColumn).Where(Function ( c ) c.ColumnName.StartsWith(“Telephone”)).FirstOrDefault

it will return the Columnname or empy string

3 Likes

Perfect!
Thanks a lot

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.