Extract specific word from a column

I have a data table containing a hotel list (column a). In the list some hotel name contains - Resort, Hotel, Motel etc.

I want to copy the word depend on the hotel name . I mean if the hotel name contains resort I want to add that in new column and if the Hotel name contains “Hotel” I want to paste/write that in column next to it. I am if activity. Can somebody please help

Hi @ravindar.singh

Use the For Each Row in data table activity to iterate through the rows of the data table and use the if activity to check if the name contains the hotel or motel or resort word.
if it contains the word then write it in the respective column.
Use three if activities for all three condition separately
Use assign to write the name into columns

let me know if you encounter any problem


1 Like


Hope the below steps would help you resolve this

  1. Let’s take you have a datatable named dt

2.now use a ADD DATACOLUMN activity and mention the datatable as dt and the new column name you want

  1. This will add the new column atlast to the right of the datatable

  2. Then use a FOR EACH ROW activity and pass dt as input

  3. Inside the loop use a IF activity and mention the condition like this


If true it goes to THEN block where we can use a assign activity and add the value you want to that new column

like this
CurrentRow(“new columnname”) = “your value”

Cheers @ravindar.singh

1 Like

Thank you for your response. The things is the rows contains some specific word like type of property they are i.e Hotel,Motel,resort. If the list contain any of this I want to extract that specific word.
Or if the hotel name contains 2 ( hotel and resort both) I can use “Else” to write the value Not found or something.

For this let’s have all the name in a array named arrvalue

In variable panel create a variable named arrvalue of type array of string with default value as {“Hotel”,”Resort”,”Motel”)

Now in if condition mention like this


Same for this as well

Hope this would help you resolve this

Cheers @ravindar.singh

1 Like


How to assign to column ?

Sorry I am very new to uipath

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.