Blog Post

Azure Integration Services Blog
3 MIN READ

Summing it up: Aggregating repeating nodes in Logic Apps Data Mapper ๐Ÿงฎ

shahparth's avatar
shahparth
Icon for Microsoft rankMicrosoft
Apr 04, 2025

Logic Apps Data Mapper makes it easy to define visual, code-free transformations across structured JSON data. One pattern that's both powerful and clean: using built-in collection functions to compute summary values from arrays.

This post walks through an end-to-end example: calculating a total from a list of items using just two functions โ€” `Multiply` and `Sum`.

 

๐Ÿงพ Scenario: Line Item Totals + Order Summary

Youโ€™re working with a list of order items. For each item, you want to:

  • Compute Total = Quantity ร— Price
  • Then, compute the overall OrderTotal by summing all the individual totals

๐Ÿ“ฅ Input

 

{ "orders" : [ { "Quantity" : 10, "Price" : 100 }, { "Quantity" : 20, "Price" : 200 }, { "Quantity" : 30, "Price" : 300 } ] }


๐Ÿ“ค Output

{ "orders" : [ { "Quantity" : 10, "Price" : 100, "Total" : 1000 }, { "Quantity" : 20, "Price" : 200, "Total" : 4000 }, { "Quantity" : 30, "Price" : 300, "Total" : 9000 } ], "Summary": { "OrderTotal": 14000 } }


๐Ÿ”ง Step-by-step walkthrough

๐Ÿ—‚๏ธ 1. Load schemas in Data Mapper

Start in the Azure Data Mapper interface and load:

  • Source schema: contains the orders array with Quantity and Price
  • Target schema: includes a repeating orders node and a Summary โ†’ OrderTotal field

๐Ÿ“ธ Docked schemas in the mapper

๐Ÿ” 2. Recognize the repeating node

The orders array shows a ๐Ÿ” icon on <ArrayItem>, marking it as a repeating node.
๐Ÿ“ธ Repeating node detection

๐Ÿ’ก When you connect child fields like Quantity or Price, the mapper auto-applies a loop for you. No manual loop configuration needed.

โž— 3. Multiply Quantity ร— Price (per item)

Drag in a Multiply function and connect:

  • Input 1: Quantity
  • Input 2: Price

Now connect the output of Multiply directly to the Total node under Orders node in the destination.

This runs once per order item and produces individual totals:

[1000, 4000, 9000]

๐Ÿ“ธ Multiply setup

 

โž• 4. Aggregate All Totals Using Sum

Use the same Multiply function output and pass it into a Sum function. This will combine all the individual totals into one value. Drag and connect: 

  • Input 1: multiply(Quantity, Price)
  • Input 2: <ArrayItem>

Connect the output of Sum to the destination node Summary โ†’ OrderTotal

1000 + 4000 + 9000 = 14000

๐Ÿ“ธ Sum function

โœ… 5. Test the Output

Run a test with your sample input by clicking on the Open test panel. Copy/paste the sample data and hit Test. 


The result should look like this:

{
  "orders": [
    {
      "Quantity": 10,
      "Price": 100,
      "Total": 1000
    },
    {
      "Quantity": 20,
      "Price": 200,
      "Total": 4000
    },
    {
      "Quantity": 30,
      "Price": 300,
      "Total": 9000
    }  
  ],
  "Summary": {
    "OrderTotal": 14000
  }
}

๐Ÿง  Why this pattern works

  • ๐Ÿ” Repeating to repeating: Youโ€™re calculating Total per order
  • ๐Ÿ”‚ Repeating to non-repeating: Youโ€™re aggregating with Sum into a single node
  • ๐Ÿงฉ No expressions needed โ€” itโ€™s all declarative

This structure is perfect for invoices, order summaries, or reporting payloads where both detail and summary values are needed.

๐Ÿ“˜ What's coming

Weโ€™re working on official docs to cover:

  • All functions including collection (Join, Direct Access, Filter, etc.) that work on repeating nodes
  • Behavior of functions inside loops
  • Real-world examples like this one

๐Ÿ’ฌ What should we cover next?

Weโ€™re always looking to surface patterns that matter most to how you build.

If thereโ€™s a transformation technique, edge case, or integration scenario youโ€™d like to see explored next โ€” drop a comment below and let us know. Weโ€™re listening.

๐Ÿงก Special thanks to Dave Phelps for collaborating on this scenario and helping shape the walkthrough.

Updated Apr 04, 2025
Version 3.0

1 Comment

  • Guptthha's avatar
    Guptthha
    Copper Contributor

    Hi there, for some reason we use traditional xslt, is three any way we can export it into microsoft data mapper version of xslt. So that it makes easy for new enhancements