Get Sum for One Variable for All Transaction Items

Hi,
Using REFramework.

Let’s say I have 10 records pulled from db to be processed which is pushed into Orch queue.
Then, for each of this record, i would need to process and get details etc on the web.
Let’s say details gathered:

int pieces
double price

Question is, how can I accumulate the price for each items and only get one total sum at the end of the whole process after all items have been processed?

So at the end of the process I would get the one totalPriceforAll for that 10 records

I’m thinking of pushing the variables gathered into db first, then selecting it again? But I’m not sure how that’s different than just directly processing without pushing into db first.

Please help!
Thx

Hey @syezids ,

You can create a temp csv file when the robot starts, into which you can add the price after each transaction.
In the EndProcess state, you can write a sequence that will read this csv file and then just sum the price.

However, the limitation of this approach is that if you have multiple bots processing the same queue then each bot will only have the sum of the transactions it processed.

hi @manishjagtap!

Thanks for the fast reply.

I understood the idea of ur approach however i have another question.

Would your proposed solution be a better practice/faster execution than just storing the price into the db, then at the EndProcess, select those columns to sum up.

Can you give me your insights on this.

Hey @syezids ,

In terms of performance, inserting into a DB will ideally take more time than writing it to a local CSV file.
There would also be a possibility of network timeouts that might happen during DB write/reads, which would need to be handled.
Also, there are additional infrastructure costs involved in setting up a DB.

But, It would again depend on your requirements.
If there is a requirement to keep the data for the long term or for audit purposes, then using a database would be a better approach.

that was clear. thanks!

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