Building DataTable help


I am new to using DataTables in UiPath and trying to build a DataTable to tally up results basd on an “If condition”. I have the “If condition” logic completed but need help with adding a row to the DataTable with the results.

The workflow process is as follows:

  1. An email is read.
  2. The email content is reviewed against a set of keywords from an excel reference list (columns are: Keyword and Order Topic).
  3. If there is a match with the keyword, it adds a “Write line” (for debugging), grabs the Order Topic and I want it to add the Order Topic and a “1” to a new DataTable (Columns are: Order Topic, Result).
  4. When finished, sum up results and highest Order Topic will be the result. (Doesnt need to be answered in this post as I will be using instructions from a previous post)

I have been following this Youtube Tutorial from @AndersJensen but having no luck. Great tutorial but some user error I cant see.

The final DataTable with the successful match results should look something like:
Order Topic, Result
Food, 1
Food, 1
Food, 1
Stationery, 1
Stationery, 1

Reference Table attached - Topic Reference List.xlsx (16.2 KB)
Sample of customer example 1 (food).pdf (17.4 KB)
UiPath Main Attached.xaml (20.2 KB)

Thank you

1 Like

Hi Steven… you just need to move out your “Buid DataTable” outside the “For Each Row” activity as the datatable is being rebuilt with each iteration thus it ends up empty. I have attached the revised xaml file. I commented out my AddResult activities as yours works fine too. It’s just that we have different ways of doing things. You can also check it out for your reference.

UiPathMain_Rev.xaml (22.5 KB)


Thank you @avejr748


I appreciate the quick response.

1 Like

You’re welcome. I’m glad to help fellow RPA enthusiast

1 Like

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