How can I write a csv file using transaction items?

Hello everyone,
I’m building my first automation with Reframework and I need a solution to write the output of my process.

I’ve build a dispatcher that reads a csv file and stores it in a datatable variable and then I add to the dedicate orchestrator queue every row of the table as a transaction item (with the specific content).
Then I’ve built a performer that gets the transaction items from the orchestrator queue and performs actions on a system.

The output that I should have is the same csv file that I read at the beginning with three new columns (outcome, KO motivation and a number returned by the system). How can I write a csv file that content a transaction item for each row with new information too?

Hi

You can either write all the data one by one in a data table first and then write it to CSV with WRITE CSV activity
https://docs.uipath.com/activities/docs/write-csv-file

or

We can use APPEND TO CSV where again data table forms as input

https://docs.uipath.com/activities/docs/append-csv-file

So i would suggest the first method to use as it way more easy

Cheers @valerio.boffino

The first method means if the automation faults part way through, what it has already processed will not be reflected in the file. You should always write logs item-by-item, for this reason. Don’t write them all at once at the end.

Thank you for reply. I know how to write a csv file but I don’t know how to create the datatable that I need from the transaction items. I want that every transaction item will be a row of my datatable but I don’t know how to do it.

I think that I could use the activity “build data table” and that use the activity “add row” and pass it an array of variables (eg transactionItem.specificContent(“something”).toString). Is it correct?

Exactly
So that for each transaction the data that got generated and your status column Can also be updated to that data table

Once after updating for all transaction then let’s write it to csv file before closing the process

Cheers @valerio.boffino