# Copy Data

<figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2FoHPCK5soxTU066yuVcsP%2Fimage.png?alt=media&#x26;token=d4ec35fa-18a8-4b36-aedc-b026d1102e30" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The Copy Data node only works in Runtimes v4.2 and up.&#x20;

In current Shared Europe (v3 Windows) or 4.1 kubernetes runtimes, an error will show:\
"The current flowchart node is not supported by this version of the WEM runtime."
{% endhint %}

The **Copy Data Node** enables you to transfer data from a **Source List** to a **Destination List** with optional filtering. You can apply a **list filter** or **filter expression** to refine the data being copied with the 'source list filter' property. Additionally, a user-friendly **Mapping overlay** allows you to align source values with destination fields efficiently.

Once a **Source List** is selected, it cannot be changed. If a different source is needed, a new Copy Data Node must be created.

When copying to a **persistent (database) list**, the option **Save directly to the database** becomes available, allowing data to be stored immediately without requiring an additional save step.

If the **Source List** is a **nested list**, you can choose to limit the copy action to the context of the parent row. If this setting is disabled, all rows from the nested list will be copied across all parent rows.

Before defining the **Mapping**, the **Destination List** must be selected. This ensures that the source data can be correctly mapped to the appropriate fields in the destination.

By streamlining the data transfer process, the Copy Data Node makes it easier and faster to copy data between lists while maintaining accuracy and flexibility.

<figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2FeJtyLzPPq5Vd0Bfqw29s%2Fimage.png?alt=media&#x26;token=427f9002-b325-48a3-a2ac-c733201dd766" alt=""><figcaption></figcaption></figure>

### Demonstration:

**Use-case**: Copy Sent Emails list to the email archive.

### Setting up the copy node

There is a transient/temporary list called Sent Emails that contains all recently sent emails and an email archive database list to keep track of sent emails.

<figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2F22gVQpwTkEzGmQgnEFxM%2Fimage.png?alt=media&#x26;token=273fa33c-6f36-4c8c-9269-2bad9ce0a45b" alt=""><figcaption></figcaption></figure>

The first step is locating the flow in which the process needs to take place and adding the Copy Data Node to the flowchart. This opens a popup where the source list is selected, In this case we select the Sent Emails list as this is the list where the application should copy from. &#x20;

<figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2FgM3pL8GlGInGb0o2Saca%2Fimage.png?alt=media&#x26;token=1d70937f-8e8a-4d58-8389-ccb538a23010" alt=""><figcaption></figcaption></figure>

Once this is done the node is shown in the flowchart with the source list in the name. The next step is selecting the destination folder by dragging and dropping the list to the correct property or by selecting the property first. The filter field is left empty for this usecase as we do not use a filter for now, this field can be used for a filter or filter expression to select a certain set of rows from the source list.&#x20;

<figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2FktXjrUCfPkRneQMD6kzD%2Fimage.png?alt=media&#x26;token=b96439d3-2e98-45e2-ae70-cd08781034c8" alt=""><figcaption></figcaption></figure>

As there are no other actions in this process and no additional steps need to be saved, we can enable saving directly to the database, eliminating the need for a Save Database Node.

{% hint style="info" %}
The destination list property has to be set before continuing as the mapping is only possible when the destination is known.&#x20;
{% endhint %}

## Editing the Mapping

In the previous section the node has been set up and added to the application flow with the right properties. The node now needs to know which fields are supposed to go into which field of the destination list. For this example, this is straightforward because the source and destination have the same name; however, this is not always the case, so mapping is always necessary.

The mapping screen can be opened by selecting 'Edit Mappings' in the node properties or by double-clicking the node.

<figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2FUsyexnjNg61fzLoTfDGI%2Fimage.png?alt=media&#x26;token=74d44a0b-3158-47da-a9b4-34e3eaa02c50" alt=""><figcaption></figcaption></figure>

The `destination` fields can now be selected by either clicking the 'Add' button at the top left of this window, clicking the dotted line box, or dragging and dropping the `destination` fields into the dotted box. The add button and clicking the box will open a overlay with the available **`destination`** fields to select.&#x20;

<div><figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2FNhniBT2lOlQyN9xkWrOz%2Fimage.png?alt=media&#x26;token=9c311ee2-c386-49cb-bd1b-72eba0bf75a8" alt=""><figcaption></figcaption></figure> <figure><img src="https://1449034948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L_NpOsk0sjotPXNy29Q%2Fuploads%2FMix6LU7WSm6mMJsFh5Xn%2Fimage.png?alt=media&#x26;token=6bf68e5c-95da-44af-a43e-542cfa052e00" alt=""><figcaption></figcaption></figure></div>

The added fields are displayed in two columns: the destination field name on the right and the source value column on the left. The source values are typically fields from the source list, directly inserted into the expression field. Alternatively, they can be expressions that generate values or values derived from other fields through expressions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wem.io/platform/wemmodeler/flowcharts/copy-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
