---
category: [Administration & Integrations, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions, Platform and Product Extensions/Workday Extend, Platform and Product Extensions/Integration]
keyword: [Extend, Orchestration Builder, Orchestrate, Orchestration]
nav: wcp_docs
parent_url: /wcp_docs/
title: Add Aggregations
layout: subsection
---

### Prerequisites

Create an orchestration containing a <b>Loop</b>, <b>Batch Loop</b>, or <b>Join Loop</b> step.

### Context

Aggregation is the process of condensing data items into a single output item by applying a function called an aggregation strategy to each iteration of a loop.  In Orchestration Builder, you can apply an aggregation strategy to a <b>Loop</b>, <b>Batch Loop</b>, or <b>Join Loop</b> step. You can include any data item that's in scope for the loop.

### Steps

1.  To add an aggregation, click the 3 dots menu on the relevant loop step and select <b>Add Aggregation</b>.
2.  Provide a <b>Reference Name</b> for the step.
3.  Click <b>Add Output</b>.
4.  Provide a <b>Name</b> for the output and from the <b>Strategy</b> drop-down list, select the aggregation strategy you want to use with it.
5.  Click on the output to open its configuration panel. The information required here depends on your choice of aggregation strategy.

    All aggregation strategies enable you to specify a <b>Condition</b>. Orchestration Builder only aggregates items for which the condition evaluates to `true`.

    To throw an exception when no input items meet your selection criteria, select the <b>Fail When No Inputs</b> check box.

    This table summarizes the purpose of the available strategies and their configuration options:

<table><thead><tr><th>Aggregation Strategy</th><th>Description</th></tr></thead><tbody><tr><td>XML Fold</td><td>Aggregates XML fragments and outputs them as a single XML document. <p>In the <b>Select XML Fragment</b> field, use Expression Builder to define an XML fragment for inclusion in the aggregation during a loop iteration.</p> <p>To add an XML declaration to the output document, select the <b>Include XML Declaration</b> checkbox.</p> <p>Enter a <b>Header</b> and <b>Footer</b> for the output document, and specify a <b>Line Separator</b>, if required.</p> <p>On the <b>Namespaces</b> tab, add namespaces to the output document, if required.</p> <p>On the <b>Advanced</b> tab, define a specific Xpath node for inclusion in the output, if required.</p></td></tr><tr><td>CSV Fold</td><td>Aggregates CSV rows and outputs them as a single CSV document. <p>In the <b>String List</b> field, use Expression Builder to define a CSV row for inclusion in the aggregation during a loop iteration.</p> <p>Alternatively, from the <b>Format</b> drop-down list, select a custom CSV format. You can create these using <b>CSV Formats</b> in your application's Settings.</p></td></tr><tr><td>JSON Fold</td><td>Aggregates JSON fragments and outputs them as a single JSON array. <p>In the <b>Select JSON Fragment</b> field, use Expression Builder to define a JSON fragment for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Text Fold</td><td>Aggregates text fragments and outputs them as a single text document. <p>In the <b>Select Text</b> field, use Expression Builder to define a text fragment for inclusion in the aggregation during a loop iteration.</p> <p>Select the <b>Content Type</b> of the specified text:</p><ul><li>    application/json
</li><li>    application/octet-stream
</li><li>    application/x-www-form-urlencoded
</li><li>    application/xml
</li><li>    text/csv
</li><li>    text/html
</li><li>    text/plain
</li><li>    text/xml
</li></ul> <p>Specify a <b>Line Separator</b> for the output document.</p> <p>Define a <b>Header</b> and <b>Footer</b> for the output document, if required.</p></td></tr><tr><td>Number List</td><td>Aggregates numbers and outputs them as a list of type <code>NumberList</code>. <p>In the <b>Select Number</b> field, use Expression Builder to define a number for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>String List</td><td>Aggregates strings and outputs them as a list of type <code>StringList</code>. <p>In the <b>Select String</b> field, use Expression Builder to define a string for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Boolean List</td><td>Aggregates boolean values and outputs them as a list of type <code>BooleanList</code>. <p>In the <b>Select Boolean</b> field, use Expression Builder to define a boolean value for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Maximum</td><td>Aggregates numbers and outputs the maximum value among them. <p>In the <b>Select Number</b> field, use Expression Builder to define a number for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Minimum</td><td>Aggregates numbers and outputs the minimum value among them. <p>In the <b>Select Number</b> field, use Expression Builder to define a number for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Sum</td><td>Aggregates numbers and outputs the sum of their values. <p>In the <b>Select Number</b> field, use Expression Builder to define a number for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Count</td><td>Outputs a count of the aggregated items.</td></tr><tr><td>Date List</td><td>Aggregates Dates and outputs them as a list of type <code>DateList</code>. <p>In the <b>Select Date</b> field, use Expression Builder to define a date for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Local Date Time List</td><td>Aggregates Local Date Times and outputs them as a list of type <code>LocalDateTimeList</code>. <p>In the <b>Select Local Date Time</b> field, use Expression Builder to define a Local Date Time for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Local Time List</td><td>Aggregates Local Times and outputs them as a list of type <code>LocalTimeList</code>. <p>In the <b>Select Local Time</b> field, use Expression Builder to define a Local Time for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Zoned Date Time List</td><td>Aggregates Zoned Date Times and outputs them as a list of type <code>ZonedDateTimeList</code>. <p>In the <b>Select Zoned Date Times</b> field, use Expression Builder to define a Zoned Date Time for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Zip Archive</td><td>Aggregates data and outputs it as a Zip archive. <p>In the <b>Select Data</b> field, use Expression Builder to define data for inclusion in the aggregation during a loop iteration.</p> <p>In the <b>Path</b> field, use Expression Builder to define the path within the Zip archive for the current data item.</p></td></tr><tr><td>String Map</td><td>Aggregates key and String value items and outputs them as a map of type <code>StringMap</code>. <p>In the <b>Select String Key</b> and <b>Select String Value</b> fields, use Expression Builder to define the key and value of a map item for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Number Map</td><td>Aggregates key and Number value items and outputs them as a map of type <code>NumberMap</code>. <p>In the <b>Select String Key</b> and <b>Select Number Value</b> fields, use Expression Builder to define the key and value of a map item for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Boolean Map</td><td>Aggregates key and Boolean value items and outputs them as a map of type <code>BooleanMap</code>. <p>In the <b>Select String Key</b> and <b>Select Boolean Value</b> fields, use Expression Builder to define the key and value of a map item for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Date Map</td><td>Aggregates key and Date value items and outputs them as a map of type <code>DateMap</code>. <p>In the <b>Select String Key</b> and <b>Select Date Value</b> fields, use Expression Builder to define the key and value of a map item for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Local Date Time Map</td><td>Aggregates key and Local Date Time value items and outputs them as a map of type <code>LocalDateTimeMap</code>. <p>In the <b>Select String Key</b> and <b>Select Local Date Time Value</b> fields, use Expression Builder to define the key and value of a map item for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Local Time Map</td><td>Aggregates key and Local Time value items and outputs them as a map of type <code>LocalTimeMap</code>. <p>In the <b>Select String Key</b> and <b>Select Local Time Value</b> fields, use Expression Builder to define the key and value of a map item for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Zoned Date Time Map</td><td>Aggregates key and Zoned Date Time value items and outputs them as a map of type <code>ZonedDateTimeMap</code>. <p>In the <b>Select String Key</b> and <b>Select Zoned Date Time Value</b> fields, use Expression Builder to define the key and value of a map item for inclusion in the aggregation during a loop iteration.</p></td></tr><tr><td>Custom Fold</td><td>Aggregates and outputs data items of any of these types, which you can select from the <b>Output Type</b> drop-down list: <ul><li>    <code>String</code>
</li><li>    <code>Boolean</code>
</li><li>    <code>Number</code>
</li><li>    <code>Text</code>
</li><li>    <code>Data</code>
</li><li>    <code>StringList</code>
</li><li>    <code>BooleanList</code>
</li><li>    <code>NumberList</code>
</li><li>    <code>JSON</code>
</li><li>    <code>XML</code>
</li><li>    <code>CSV</code>
</li><li>    <code>Date</code>
</li><li>    <code>LocalTime</code>
</li><li>    <code>LocalDateTime</code>
</li><li>    <code>ZonedDateTime</code>
</li></ul> <p>In the <b>Initial Value</b> field, use Expression Builder to define the first value for inclusion in the aggregation. Example: the third value in a <code>NumberList</code>.</p> <p>In the <b>Next Value</b> field, use Expression Builder to define how the aggregation proceeds in subsequent iterations. Example: only include even numbered values.</p></td></tr></tbody></table><br/>

6.  Add and configure additional outputs, as required.


