Support Portal

for ProcessRobot and WinAutomation

Start a new topic

Search a keyword inside a Data Table

ADMIN

Assume that you have a Data Table type variable %QueryResult% and want to know if it contains a word ‘searchword’.


The %QueryResult% variable contains a Data Table type variable which is a complex data structure, meaning that it is not a single value, but consists of multiple rows and columns. To search inside a Data Table you will need to iterate through its rows first (using a “For Each” loop action) and then iterate through its columns using another, nested “For Each” action. Attached is an example on how to do this.

 

However, this may be slow, especially for large query results. The most optimal approach would be to search for the keyword directly though an SQL statement, which would return a TRUE/FALSE value, instead of the full result table.

 

The .Columns property of a DataTable variable is a list containing the names of the columns of the DataTable.

waj
Login or Signup to post a comment