I am learning REFramework currently and I am trying to see if I can keep appending the results of the transaction items present a specific queue to the same output data table and finally when the queue items are complete, output the results of the data table to an excel sheet.
For example:
I am looping through a data table that has Invoice No, Due Amount and Late Fee. I am add the invoice number as queue items and I am trying to calculate the total due for each invoice and finally write the results to the excel file. But instead of updating the excel file while every transaction is processed, I am trying to see if I can just update the excel file once and for all at the end of the process.
Not sure if it’s a good practice though, but just trying to see if it’s logically possible using REFramework.
Yes, you can achieve by using a DataTable to store the results and writing to Excel at the end of the process.
First, build a DataTable (dtResults) with columns for Invoice No and Total Due. Then, loop through each queue item, retrieve the Invoice No, Due Amount, and Late Fee, calculate the Total Due (Due Amount + Late Fee), and add the result as a new row in dtResults. Once all queue items are processed, use the “Write Range” activity to export dtResults to an Excel file.
If you found helpful mark as a solution.
Happy Automation
Duplicate Post. Refer answer in the same below link
As you know - there are different State in RE Framework. Do following actions mentioned below to achieve this
From INITIALIZATION State - Use Activity Build Data table and create a structure first. Use datatable variable to store the output. Scope of this data table should be the maximum
Pass the datatable to Process.XAML. Inside Process.Xaml - After calculation - Once you identify all the values which are expected to add to excel file - Use below activity to add to Data table instead of excel writing. Use activity Add Data Row
Since you are passing the datatable which is created from the Initialization as both input and output - It will keep adding the rows during the run time
From Last END PROCESS STATE → Write the datatable back to excel