How to check if a certain string exists in a data table?


#1

Hello everyone,

I have a data table and I would like to check for all the rows if the word “Hello” is contained in such rows.

When I use the activity for each row and then if -> datatable.tostring.contains(“Hello”) it does not work.

What could I do?

Thanks !


#2

Hi @pal1910

You are almost there. Use Output Data Table activity to output your entire Data Table to a string. Then use your mentioned .Contains method with that string to do the check.


#3

Thank you very much.

However, I would like to know the number of the row that contains the string.

If I convert the data table into a string, I will not be able to know the number of the row. Am I right?


#4

@pal1910

Use this

row.ItemArray.Contains(“Hello”).ToString

And Please Update


#5

It doesnt work.

Regards

@Himanshu.joshi


#6

@pal1910

See attachment for the working solution :slight_smile:
CheckIfRowContainsString.zip (7.6 KB)

I hope it is clear, but let me know if you have any questions.