# Set variables shape

## Introduction

The **set variables** shape is used to set values for flow variables and/or metadata variables at any point in a flow. &#x20;

## Need to know

When defining variable values you can use:

* static text (e.g. `blue-003`)
* [payload syntax](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/payload-variables) (e.g. `[[payload.productColour]]`)
* [flow variable syntax](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables) (e.g..`{{flow.variables.productColour}}`)

{% 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 set variables shape

**Step 1**\
In your process flow, add the **set variables** 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%2FjlATE2qx5xbt8DR67wDd%2Fset%20variables%201.png?alt=media&#x26;token=88c99177-8ef1-48f5-9141-b01b9f31c4a5" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 2**\
Access shape settings:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F8osGjv0sq5sCRUUlP4LZ%2Fset%20variables%202.png?alt=media&#x26;token=41d55b16-c99d-4f39-8561-b34ff11d9e70" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 3**\
Click the add new variable option associated with the type of variable that you want to define - 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%2FrqifU4B3l7oRWmP5dlAu%2Fset%20variables%203.png?alt=media&#x26;token=5c5c1564-8a11-4e4e-add2-7539e56d7abb" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 4**\
Options are displayed for you to define the required variables and their values. How these are displayed depends on the type of variable you've chosen to add:

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPq80F8deQ3i4P3iazHRj%2Ficon%20decision.svg?alt=media&#x26;token=61be5bf3-7235-45fe-af5f-726229df8dd6" alt="" data-size="line"> Variable (flow variables)</summary>

Choosing to add a **variable** displays a **flow variable** drop down field:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F7fdNvB0ecNoe7ZKHnibU%2Fset%20variables%204.png?alt=media\&token=33a6c9ea-0a1d-4b92-bdf9-9e5823b9b67a)

From here you can select any [flow variable that's been defined for this process flow](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables) - for example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FbsQf5ss6RyB9qNwnwTOO%2Fset%20variables%205.png?alt=media\&token=4a61438a-0611-4c4b-9e19-91fe7de9abb6)

You then define the required values to be applied, and confirm with the **accept** button:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FF4ZHkELUPO8DhcWeoNk2%2Fset%20variables%206.png?alt=media\&token=414900ee-4c9e-426b-959a-eaafc1d1746e)

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPq80F8deQ3i4P3iazHRj%2Ficon%20decision.svg?alt=media&#x26;token=61be5bf3-7235-45fe-af5f-726229df8dd6" alt="" data-size="line"> Meta (payload metadata variables)</summary>

Choosing to add a meta variable displays **key** and **value** fields:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FQqL5BrCEV25AzvP52myA%2Fset%20variables%204a.png?alt=media\&token=5de9b326-f9de-4115-a25f-5f306d80d928)

From here you define your variable name as the **key** and set the the required **value** to be applied - then confirm with the **accept** button:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FTUPFlsd6AdtQEaMTa4fs%2Fset%20variables%205a.png?alt=media\&token=509365c0-d94c-4675-8ced-e87ded130be2)

</details>

**Step 5**\
Once variables are accepted they're added to the settings panel (you can edit/delete as needed):

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F870TMIpaKO6S2TzgwiNn%2Fset%20variables%208.png?alt=media&#x26;token=ce789e51-2f9b-4c8d-a7e1-e7d880d0ac8a" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 6**\
Save the shape.
