# Split shape

## Introduction

The `split` shape is used to split out a given payload element. When data is split, the specified element (including any nested elements) is extracted for onward processing.

For example, your process flow might receive customer data from a source connection, but you need to send address details to a different endpoint. In this case, you'd use the [route shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/route-shape) to create two different routes, mapping just customer data down one, and splitting out addresses for the other.

{% hint style="info" %}
A single incoming payload for [any process flow shape](https://open.gitbook.com/~site/site_dIV1g/~/revisions/9dTvdvRJIRVZQXuBMMnJ/process-flows/building-process-flows/process-flow-shapes) should not exceed 500MB.

We recommend processing multiple, smaller payloads rather than one single payload (1000 x 0.5MB payloads are more efficient than 1 x 500MB payload!).

For payloads up to 500MB, consider adding a[ flow control shape](https://open.gitbook.com/~site/site_dIV1g/~/revisions/9dTvdvRJIRVZQXuBMMnJ/process-flows/building-process-flows/process-flow-shapes/standard-shapes/flow-control-shape) to batch data into multiple, smaller payloads. Payloads exceeding 500MB should be batched at source.
{% endhint %}

## Adding & configuring a split shape

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FWFgpgnhmZXZnH4Aau1Tz%2Fdemo%20split%20shape.gif?alt=media\&token=b03bdf59-f487-46cc-86d7-f7ee4d63d4b5)

</details>

{% stepper %}
{% step %}
**Add a split shape**

In your process flow, add the `split` shape in the usual way:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FFys9R3K6ImvMrrV65We0%2Fsplit%200.png?alt=media&#x26;token=75f16db4-f956-4da6-a7ad-021e00f88bd7" alt="" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Access settings**

Click the `settings` icon for the `split` shape:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FN8P2zrvAklyOGyTS4eDT%2Fsplit%20shape%20settings.png?alt=media&#x26;token=79abc72a-827f-46e9-9205-e3736b22d2a1" alt="" width="326"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Select source details (optional)**

If appropriate, enter a `source integration` and a `source endpoint` - for example:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FyyzPGlDnP2cPFQMQX3Uz%2Fsplit%201b.png?alt=media&#x26;token=ec2d1798-bec6-4c5b-a4f2-88e90f766cba" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Adding this information allows you to navigate the associated schema to determine where data is split. This is easier than entering a path manually, but it's not essential.
{% endhint %}
{% endstep %}

{% step %}
**Define where incoming data is split**

Move down to the `level to split` section. If you added source details in the previous step, you can use the dropdown data path to select the required data element to split - for example:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FbHnuhcgVJlZQaX28g0Le%2Fsplit%201c.png?alt=media&#x26;token=37af2d3c-e3c0-4616-b695-1e1c88777afe" alt="" width="375"><figcaption></figcaption></figure></div>

Alternatively, you can enter the required data path manually. For example:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FqBL5D4mO5zOHA9niSnrM%2Fsplit%20shape%20settings%202a.png?alt=media&#x26;token=f604e73c-d078-4f53-a368-e74fa55857b3" alt="" width="375"><figcaption></figcaption></figure></div>

Here, `customer.addresses` targets the `addresses` array within a `customer` object.&#x20;

{% hint style="info" %}
Remember - any data (including nested data) within the selected element will be split out into a new payload.
{% endhint %}
{% endstep %}

{% step %}
**Add a wrapper key (optional)**

If required, you can add a `wrapper key`. This wraps the entire payload in an element of the given name - for example:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F0Xrx0yg7R521DnerqCxP%2Fsplit%201D.png?alt=media&#x26;token=1fadb364-55ca-4a88-85aa-b9222fa59189" alt="" width="375"><figcaption></figcaption></figure></div>

Here, defining `ADDRESSES` as the wrapper key would wrap the payload as shown below:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F88gH5sudCsBStNoAv4mW%2Fsplit%201e.png?alt=media&#x26;token=af682428-865c-4a40-9caf-f173a8a8ee3b" alt="" width="327"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Save changes**

Save shape settings to exit back to the canvas.
{% endstep %}
{% endstepper %}
