Dear all,
I am trying to find out:
- whether the keyword is in a cell of a certain row
- what is the position of that cell
How can i do that?
Dear all,
I am trying to find out:
How can i do that?
Hi @avene
Is it always the same column that you would scan for the specific keyword?
If so, you could follow those steps:
row
is each item of the loop):row.Item("yourColumnName").ToString.Contains("yourKeyWord")
The rest is figuring out the current index of the row you are iterating through.
This can be done with:
yourDataTableVariable.Rows.IndexOf(row)
This will return an Integer value for the current row.
Hi! thanks for the reply
For my project, I am looking at the same row that I would scan the specific keyword.
so would it work if i do row.tostring.contains(“keyword”)?
To access any item in a specific Data Table with a simple assign activity without any loops, the syntax would look like this:
yourDataTable.Rows(yourRowIndexAsInteger).Item("yourColumnName").ToString.Contains("keyword")
Example:
DataTable.Rows(0).Item("Cars").Contains("Audi")
This will return True if the column “Cars” in the first row of the data table contains keyword “Audi”.
As @loginerror suggested you can read all data in datatable then iterate using for each row,
and if you wants to search in a complete row you can use
dataRowA.Itemarray.toList().contains(“Keyword”)
If it returns true
find column index using dataRowA.Itemarray.toList().indexOf(“Keyword”) and
Row index using dataTable.Rows.indexOf(datarowA)
Thanks