Finding out if row in data table contains string

I have a datatable that is produced from a screen scraping and I need to check each row to see if it contains the strings “AUTH” and "GRANTED. What is the best way to do this?

Hi @lhendrix

In case you need to check the entire datatable at once whether it contains the two key words you have mentioned irrespective of the row or the column, then you can use Output Data Table activity to convert the entire datatable into a String variable. Then you can use string comparison to check whether the data table has those key words or not like

StringVariable.Contains("AUTH") OR StringVariable.Contains("GRANTED")

That’s one approach depending on your requirement. Other one is, you can check on every row by looping through the data table using a For Each Row activity.

For Each Row - row of DT
    IF Activity - IF row("ColumnName").ToString.Contains("GRANTED") OR row("ColumnName").ToString.Contains("AUTH")

So in the For Each Row Activity, you can use a IF activity to check whether you have the value in that particular column, and in the row and do the processing as required

Hope this helps!!

Let know whether it helps :slight_smile:


By another approach you can use Lookup Range activity for DT. The output will come as Cell Address.

Let us know if it helps…