Calculate total sum of time from an array of start/end datetimes

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!

Welcome to the Make community!

This seems like a complex scenario you’re trying to make, perhaps exporting the blueprint might help others replicate the issue to be able to answer your question.

At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826

Uploading it here will look like this:

blueprint.json (123.4 KB)

If possible, could you also provide the output bundles of the the initial modules by running the scenario, then clicking here and copying the contents:

Screenshot_2023-08-29_100800

This will allow others to better assist you. Thanks!

2 Likes

Yes, of course.

Here are the blueprint:

blueprint.json (42.2 KB)

And here’s the output bundles from PagerDuty API call:

pagerduty-api-call-output-bundle.json (6.2 KB)