Correct way/ time to Filling excel file

Hello, I have a process made of four steps.
In each step a DataTable is printed.
I want to know the correct moment to write these dataTables in my Excel File? At The end of each step? Or at the end of all the steps?
Could someone give me a hint?
Thanks in advance

For more precision I’m using the Reframework.
In Get Transaction I’m looping inside an array of stores (10 stores), so each store is my transaction item.
Once obtain my Transaction Item, we reach the Process state which incorporates 4 steps. In each step a DataTable is retrieved so in total 4 DataTables are produced.
My Question is: When is it preferrable to fill these DataTables in my Excel File? At the End of each step? Or at the end of the four steps?
More nor less, We’ve imposed a max retry in the config file to 3. So in case of problem the transaction item is tried 3 times. If an error occur during one of the steps in the Process state, let’s suppose that an error occur at the third step, What about the Datatables created prior the error? How can we do to write them to the excel file in case of an error in order to avoid loosing data?
Thanks in advance

Hey,
It depends of what you need, if you won’t use (after the execution process) the Datatable created on each steps, then don’t save them in your Excel file. If you need them all, you can save them at the end of each steps.

In case of an error, you can also catch it and save your Datatable in a backup Excel file. That might be a good way to recover the datas.

1 Like

Thanks @Damien for your quick answer.
The DataTables extracted have to be filled inside an Excel file since it will be send as a report after having extracted the informations from the 10 stores (10 Transaction Items in our case)
Let me explain: The first step extracts a DataTable and save it in “Sheet1” of the excel, the step 2 save the DT in “Sheet2”, the step 3 save DT in “Sheet3” and step 4 save DT in “Sheet4” .
So each Transaction item produces 4 DT saved in 4 different sheets of the excel file.
NB: All the DT produced will be saved in the same excel file at the end.
I don’t know if I’ve made myself clear by now.
Thanks in advance.

Ok, so the best thing to do, is to save at the end of each steps. In this way you will be sure that your Excel always have valid datas inside.

It is a wrong idea to save everything at the end in this case, because if it crash you won’t have anything in your Excel.

And you also have to catch all errors, and create a backup file/excel with your Datatables in the catch part to be able to recover them.

1 Like

Thanks very much for your marvellous insights @Damien
Nevertheless I have one question. At the end I shall remain with one and unique file excel.
In case of errors. the DT is saved in the back up file, How will I do to reconnect this file with original one so as to make it one and unique when the transaction items are all processed?
Thanks

For your process I would have use a state machine, eg : if I got a failure in the step 4, I would just run the 4th step to recover that missing part in my Excel file.
The backup file shoudn’t be merged with the original one. If there is a error you have to replay from the step where the process failed. I would be wrong to merge a corrupted backup file with your clean original one.

1 Like

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