Manipulating data in a DataTable
can be extremely slow and difficult.
You have to go through each DataTable
row, get the values from the columns you need to calculate, and then add the calculated value to the new column.
The script looks like this:

Since version 23.0.20, IBM Robotic Process Automation has introduced the --expression
parameter in the addColumn
command, which allows you to inform the expression when creating the column, allowing its value to be calculated automatically, without the need for extra code and extremely quickly.
The script looks like this:

This script below has an example using both solutions (just uncomment the AddCalculatedColumnWithExpression
or AddCalculatedColumnOldWay
routine to test both scenarios):

You can download the entire script from here.
It can be seen that in the simple example with 1000 rows the performance of the new functionality is amazing.
foreach
+ evaluate
+ updateRow
With 1000 rows: 00:00:08.2875030
addColumn --expression
With 1000 rows: 00:00:00.0214738
NOTE: The performance numbers provided above are based on my own local environment. Actual performance may vary depending on your system.
#IBMRPA #Performance