Key term comparison

Hello, I am trying to do a key term comparison through UI path and was wondering if it is possible. I have a list of key terms in an excel file and I would like to check a word document to see which of those key terms it contains, is this possible in studio x?

Hi @trevor.thenga

Welcome to UiPath Community !!

Please try below steps.

  1. Use the “Read Range” activity to read the list of key terms from your Excel file and store them in a DataTable variable.
  2. Use the “Read Text File” activity to read the contents of your Word document and store them in a string variable.
  3. Use a “For Each Row” activity to loop through each row of the DataTable containing the key terms.
  4. Inside the loop, use the “String Contains” activity to check if the current key term exists in the string variable containing the contents of the Word document. You can store the result of this check in a Boolean variable.
  5. Depending on the value of the Boolean variable, you can take further action in your automation. For example, you could write the key term to a new Excel file, or you could highlight the key term in the Word document.

Hello Nitya, this is very helpful, but I am a beginner and need some additional guidance. How do I create a datatable variable and string variable? Also not sure how to create a boolean variable, I know how to create variables, just not how to distinguish them as you did. Thank you!

Hi @trevor.thenga
To create a new variable in UiPath , use the shortcut Ctrl + K , once the variable is created then in the variable panel , you can change the variable type like- string, boolean or datatable.

Is this possible in Studio X? I am using studio x which has less features than studio. Thanks.

Yes it’s possible in Studio X

That is great news. However, I cannot find the variable panel? I also was able to create the variables but the ctrl+k shortcut did not work.

To create a variable in UiPath StudioX, you can follow these steps:

  1. Open your UiPath StudioX project and navigate to the Variables tab, which is located in the lower-left corner of the screen.
  2. Click on the “Create Variable” button to open the “Create Variable” dialog box.
  3. In the “Name” field, enter a name for your variable. Make sure to use a descriptive name that will help you remember what the variable is for.
  4. Select the data type for your variable from the “Type” dropdown list. UiPath StudioX supports a variety of data types, including string, integer, boolean, date/time, and more.

Got it, thank you! It was actually on the bottom right under “data manager”. Can you please expand on “4. Inside the loop, use the “String Contains” activity to check if the current key term exists in the string variable containing the contents of the Word document. You can store the result of this check in a Boolean variable.” I cannot find the “string contains” activity

we can use CONTAINS method from string class
like this
yourstringvariable.ToString.Contains(“your text to be found”)
which will give us boolean value as output.

My apologies I don’t think I am following, would this be an activity that I can select from the list of activities or is it something I would have to add/edit to an existing activity?

You can use the “String.Contains” method in UiPath to check if a string contains a specific substring. Here is an example:

  1. Assign the string that you want to search to a variable, let’s call it “myString”.
  2. Assign the substring that you want to search for to another variable, let’s call it “searchString”.
  3. Use the “String.Contains” method to check if the “myString” variable contains the “searchString” variable. Here’s an example of how to use this method:

myString.Contains(searchString)

  1. The above method will return a boolean value (True or False), indicating whether the “searchString” was found in the “myString”.

Here’s an example workflow to demonstrate the usage of the “String.Contains” method:

  1. Create two string variables: “myString” and “searchString”.
  2. Assign a value to “myString”, for example, “The quick brown fox jumps over the lazy dog”.
  3. Assign a value to “searchString”, for example, “brown”.
  4. Add an “Assign” activity and create a new boolean variable named “result”.
  5. In the “To” field of the “Assign” activity, enter “result”.
  6. In the “Value” field, enter the following expression: myString.Contains(searchString).
  7. Run the workflow and check the value of the “result” variable. If the “searchString” is present in the “myString” variable, the “result” variable will be set to True, otherwise, it will be set to False.

“4. Add an “Assign” activity and create a new boolean variable named “result”.” I do not have an activity for assign

To assign a value to a variable in UiPath Studio X, you can follow these steps:

  1. Open your UiPath Studio X project and go to the sequence where you want to assign the variable.
  2. Find the variable you want to assign a value to in the Variables panel on the left side of the screen.
  3. Double-click on the variable to open the Variable Editor.
  4. In the Value field, type the value you want to assign to the variable. For example, if you have a variable called “Number” and you want to assign the value 10 to it, you would type “10” in the Value field.
  5. Click on the OK button to save the changes and close the Variable Editor.

I am able to assign values to the variables but that is not an activity, that is done with editing the variables within data manager. When I search for activities to add there is no activity named “assign”

Yes there is no assign activity in StudioX.

“4. Add an “Assign” activity” did you mean something else by this?

I shared the steps as per UiPath Studio but logic would be same in StudioX