A scenario with both text and numeric aggregation needs

My scenario is supposed to pull data from Notion (Watch Database Items module) and use that data to generate one reimbursement report (Google Docs Create Document from Template module) for each person who submitted a reimbursement request.

Relevant Data

The data that are relevant in the Notion database are:

  1. Driver name (this is a relation property, and if you look in the scenario blueprint, you’ll see that I have this set up properly)
  2. Driver email
  3. Route description
  4. Date of the mileage expense
  5. Total miles for the trip
  6. Reimbursement amount for the trip
  7. Reason for the trip (event title)

My Goal

I want to group all of items 3-7 by item 1/2, sort items 3-7 by date (item 4), and display in the google doc:

  1. The driver name
  2. The driver email
  3. The current date
  4. The sum of all of the miles on the report
  5. The sum of all of the reimbursement on the report
  6. A formatted list of all of the routes, the dates, the miles driven, and the event

For example:

Driver: Jane Carman, jac@test.mail

Report date: October 6, 2025.

Total miles driven: 40

Total reimbursement: $28

Description:

  • 2025-10-02, Meeting: Office to Partner (9 miles)
  • 2025-10-03, Outreach: Office to LibraryOne (8 miles)
  • 2025-10-05, Outreach: Office to LibraryTwo (23 miles)

Where I Am

I had everything working perfectly EXCEPT for the total miles and total reimbursement summary at the top of each report. This was using a text aggregator set up as follows:

Mileage reimbursement.blueprint.json (289.4 KB)

The problem here, of course, is that the reimbursement amount gets lost when the text aggregator runs.

What Else I Tried

I tried to address this problem by changing the set-up of the text aggregator module so that instead of creating the exact string I was looking for, I created a string that had more information and had a unique separator (date + route + miles + reimbursement), then after the iterator, used a Set Variables module to turn that string back into an array using a split() function. Then I set new variables by mapping the elements of the array in order, and used a sum() function to get the total miles and total reimbursement.

At least, that’s what I thought I was doing.

The set variables module for mapping the elements of the array looks like this, which concerns me because the white background generally means you’re referring back to something that is no longer there, so did I set that up wrong?

And then the output is totally wonky in a few ways, I think all related to this one problem: the fourth variable is pulling in the date for the second DB item, so instead of the variable routeReimburse being a number, it is a string, so the sum() function doesn’t work AND the data from the second DB item disappears from the report. (When I’m done testing, the limit for the Watch New Rows module will be higher than 2, but for now, 2 has been adequate for testing.)

The blueprint with these changes is:

Mileage reimbursement (copy for figuring out totals ).blueprint.json (292.7 KB)

Any help you can give will be very gratefully accepted.

Replying to my own post here in the hopes that it will get some fresh attention. In the last week, I did figure out how to include multiple aggregators in my scenario (I’m not sure if it’s the most efficient method, but I added a Google Sheets module to hold some of the data and then a second Google Sheets module to pick the data back up) but now I’m having a new problem which I simply don’t have the brain space to work on and hope you can be helpful:

I now have the results of a numeric aggregator, which are grouped by “Driver name, driver email,” and the results of a text aggregator, which are grouped by “Driver name, driver email,” but instead of recognizing that both “driver name, driver email” are identical, when the iterator runs, I end up with twice the number of results because it iterates over the drivers for the numeric aggregator, and then again over the text aggregator.

Any advice? (I’m assuming that all of this could be avoided if I used an array aggregator, but I’m finding there to be a gap between the Make Academy sessions on array aggregators and the real-world use of array aggregators.)

Hey Rebecca,

usually you can use Aggregate to JSON yo build your own array. Can you share the output bundle of the initial module providing the data so we can see what the incoming structure is like?

Thanks for helping! Here’s the data–

output bundle - mileage.txt (33.4 KB)