What is the fastest way to update a table without looping

Hello,
I have a datatable that looks like the screenshot below, Now there is a column called SerialNumber which might have a blank cell.
What I am supposed to do is update this blank cell with its actual data by searching for ID from a table on a database.
I know I can open a connection ,start a for each and run a query to "select SerialNumber Where ID = ". But then the problem is this records might be a lot in the future and would slow down the process .

Please is there a faster way

image

I have

Hi,

Because there are much overhead for processing each activity when using ForEach or ForEachRow activity, can you try to use any loop inside Invoke Code activity? It’s faster than loop using activity in general.

Regards,

1 Like

Try this:

  1. Download table from database as datatable DT1
  2. Loop through the datatable with empty serial number
  3. If column A = empty, use lookup datatable on DT1 using the ID value from column B

Pros:

  • Downloading the DT1 from database once only
  • One loop through the datatable with empty cells
  • “Lookup Data Table” UiPath activity usually runs very fast
1 Like