Page 1 of 1

sum total from multiple values from privatedata

Posted: Fri Feb 23, 2024 6:43 pm
by rhd_ole
Hi All -

I have a privatedata key 'Price' that I need to provide sum of and I'm entirely sure the best way to do it.

Lets say there are 4 files in the run, all have a different price which is recorded to privatedata as 'Price' and I need to provide the sum of all the files in the run. The number of files will not be static.

Any ideas on how to do this? I also have the data in a csv if that helps.


Thanks

-O

Re: sum total from multiple values from privatedata

Posted: Mon Feb 26, 2024 8:31 am
by laurentd
You can use the Counter - Numberer app, which allows you to create counters independent of jobs.
Your first job comes in and creates a new counter, with name equals to a common metadata.
Following files come in and increment the counter.
At the end you can read the counter value.

Using the csv file:
You can import it in a Google Sheet using Google Sheets Connect,
then add a sum formula in a new column (using Edit values),
then lookup the sum value.
It will add the values of all cells as private data to your job.

Re: sum total from multiple values from privatedata

Posted: Mon Feb 26, 2024 9:45 am
by JimmyHartington
If you want to use the CSV you can use https://www.easydatatransform.com, which can be used as a CLI-program with Switch.
It is very affordable in regards to what it does.

See this topic: viewtopic.php?p=15038&hilit=easy+data+transform#p15038 on how to implement it.

Re: sum total from multiple values from privatedata

Posted: Mon Feb 26, 2024 2:45 pm
by rhd_ole
Thanks all - I ended up writing a script calculated the sum of the column and passed it and I used is a private data as needed.

Re: sum total from multiple values from privatedata

Posted: Tue Mar 05, 2024 6:07 am
by elija6266
Thanks @JimmyHartington for sharing this information.