I have a reporting workflow feeding into webmerge which does the following:
- 1st of each month collects all device info for reporting.
- Begins loop 1 which loops through each deviceId.
- Within loop 1 i have an additional loop this cycles through 28 / 30 or 31 iterations depending on the past months length and for each day it collects the sum of 1 attribute and the max of another attribute and writes to two arrays.
- The arrays are sent along with device info to webmerge for reporting at each iteration of loop 1 ( for each device).
-
I’ve been running this with 16 devices total and I’m at around 49 seconds execution time for the workflow. Seems the configuration of the embedded loops and the iteration length is taking quite a while.
-
Just after some suggestions as to a better way to approach this as needs to handle a lot more devices in the future.
Cheers
Hi Richard,
My suggestion would be to remove your second loop that iterates through each day of the month and use two “Data: Gauge Query” instead. You can pass in the deviceId and get the sum for the 1st attribute and the max of the other. You can specify the time range as Custom and then from your payload you will need to pass in the previous months length in milliseconds.
I hope this helps!
Erin
1 Like
Thanks Erin, the second loop was iterating through each day of the month with a custom time range per loop and two gauge queries such that ( assuming it was a 30 day month) i end up with 2 arrays with 30 values each per device.
My current fix has been to create a data table for each device that records the 2 attributes daily. At the end of the month I loop though all the devices and grab the last months table values - A lot faster processing as not having to run the data gauge queries 30x2 times per device each time.
Guess consider this resolved now…