I’m using PagerDuty integration to make API request and pull the array of my on-call shifts. Each item contains start and end datetimes for that shift. I need to iterate over the array, calculate difference between start and end to get the length of the shift in hours and then calculate the total sum.
Sounds easy but I’m having issues.
First, this is how the data looks in the beginning, when I get it from PagerDuty.
Next, I’m sending it to an iterator to iterate over Body.oncalls. I also filtered out the items where start or end is empty, since those don’t interest me.
Next, I need to somehow calculate the difference between start and end. I tried Set Variable that looks like this.
Now I need to sum up the values. I tried using Numeric Aggregator but it still produces 3 results instead of 1.
I’ve tried a bunch of different things and nothing worked. How can I aggregate multiple Operations into one result?
Just for completeness, here’s the screenshot of the entire pipeline. There are also other branches that are not relevant for this question. It’s a part of a larger scenario. For now those branches are unlinked, until I figure out this part.
Thank you!