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

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 !

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.

4 Likes

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?

@pal1910

Use this

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

And Please Update

3 Likes

It doesnt work.

Regards

@Himanshu.joshi

@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.

4 Likes

this worked perfectly! thanks for your help!

1 Like

Hi, @loginerror,

If i have multiple columns with “HELLO” how it works ???

Hi everyone,

Can we use a string variable to to check it is exists on a datatable string or not.

Regards,
Masood

Hi @Masood_Sohail,

If the loop is too old please create a new post for your query.

For your question there are multiple ways to check if a string value exists in datatable,

  1. using select statement: if you know the column name you can use dt.select(“[ColName] = '”+stringValue+“'”), this will give you array of data rows and you can convert back to table using .copytodatatable in the same select query.
  2. if you don’t know the column then you can use look up range activity: give the string input and then sheetname where you need to search and output will be the cell address of the first occurance, if there is no string present in the datatable then the output will be null.

Let us kno if this helps.
Regards,
Pavan H

Hi could you also help in a similar task ,I have extracted from structured text from a web browser containing various tasks in form of a data table. I would like to find all those tasks which contain the word Onboarding and then use the click activity to click on those links and click on another button post that.So basically what I want is the bot to extract all text by data scraping, select those text where the word onboarding is there, and then post that click on those links one by one.

1 Like

Hi @Ashish_Mehra

Have you completed the UiPath Academy Advanced Training? It contains similar workflows to what you are asking.

Hi nlee, I am currently at the orchestrator training, and I don’t think I will be able to access this part before completing the above, is there any videos or workflow you could share executing the same process.

Thank you

Due to the rules of the academy, I cannot share the workflows. There are videos on youtube if you search for UiPath Academy walkthroughs.

Regards.

Thank you so much !

1 Like

@loginerror
Can you p;ease attach xaml file