How to Aggregate Array Line Items after Looping Iterations
Contributed by: Troy Tessalone - Automation Ace - Certified Zapier Expert
About
Looping an array of line items is one thing in a Zap, but aggregating an array of line items is another in a Zap.
Arrays
Think of line items in an array like the items in an ecommerce order. (1 Order can have 1+ Items)
Use Case
You want to perform some action(s) on each line item in an array, then continue the Zap steps with the aggregated line items. (e.g. very basic example - adjusting the format of each item to be UPPERCASE)
Apps
These native Zap apps by Zapier count as 0 Tasks in Zap Runs.
Resources
Steps
- Trigger: 3APP] - AEVENT]
- UP TO YOU!
- Action: Formatter > Text > Default Value
- Use a UNIX Timestamp to get a unique ID for use in following Zap Storage steps
- Help: https://zapier.com/help/create/customize/insert-the-time-your-zap-runs-into-a-field
- Action: Looping - Create Loop from Line Items
- Handles arrays of line items
- Action: Formatter > Numbers > Perform Math Operation
- Used so the loop iterations process sequentially in order
- See the help article above.
- Action: Delay - For
- Delay For (minutes)
- Map the output from the previous Formatter step
- Action: 3APP] - AEVENT]
- UP TO YOU!
- Example: Formatter > Text > Uppercase
- Action: Storage - Push Value onto List
- Adds Items to the Array
- Action: Filter
- Loop Iteration is Last = true
- Action: Storage - Get Multiple Values
- Use the lookup key from Step 2
- Will return an array with items that were processed during the loop iterations
- Action: 3APP] - AEVENT]
- UP TO YOU!
- e.g. Add Items to an Order
- Action: Storage - Remove Value
- Remove the Storage Value as it’s no longer needed since the Zap Run has completed
Steps - Details
TIP
If you want to flatten the array line items, like a digest, then use this Zap action: Storage - Get List Values