# Importing & exporting cross-reference lookups

## Introduction

If you prefer to maintain cross-reference lookup values externally, you can easily [export](#exporting-a-cross-reference-lookup) cross-reference lookups from Patchworks, update values as required, then [import](#importing-cross-reference-lookup-values) the updated file.&#x20;

## Need to know

#### Export file format

Cross-reference lookup exports are completed in CSV format, delimited ONLY with a single comma between fields.&#x20;

The exported file includes two columns with `left_value` and `right_value`  headers. For example:

{% code lineNumbers="true" %}

```
left_value,right_value
blue,#33ADFF
red,#FF5733
yellow,#FFF933
```

{% endcode %}

### Imports

#### Import approach

When cross-reference lookup values are imported:

* Existing values are checked and updated from the import file
* Existing values are checked against both left and right values
* New values are added

#### Import file format

To import cross-reference lookup values, the import file must be in the same format as export files [above](#export-file-format), **with the same headers**. I.e.:

{% code lineNumbers="true" %}

```
left_value,right_value
value,value
value,value
value,value
```

{% endcode %}

{% hint style="warning" %}
Import files cannot exceed 5MB.
{% endhint %}

## Exporting a cross-reference lookup

To export/download a cross-reference lookup, follow the steps below.&#x20;

**Step 1**\
Log into the Patchworks dashboard, then select **process flows** <mark style="color:orange;">|</mark> **cross-reference lookups** from the left-hand navigation bar.&#x20;

**Step 2**\
Click the **download** button associated with the cross-reference lookup that you want to export:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FNGgYMfz0oK26GnV3p7vW%2Fexport%20cross%20ref%20lookup%201.png?alt=media&#x26;token=2ec10237-2c1e-439c-893a-5043cb36f370" alt=""><figcaption></figcaption></figure></div>

**Step 3**\
The download job is added to a queue and a confirmation message is displayed:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F5nQkxQAqLHUQawAIKsfz%2Fexport%20cross%20ref%20lookup%202.png?alt=media&#x26;token=690403e8-96a5-44ae-bcbd-654b7154b0a1" alt=""><figcaption></figcaption></figure></div>

**Step 4**\
When your download is ready, you'll receive an email which includes a link to retrieve the file from the **file downloads** page. If you can't/don't want to use this link, you can access this page manually by selecting the **settings** option:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FMQogzR2C31P77eCnaFjf%2Fexport%20cross%20ref%20lookup%203.png?alt=media&#x26;token=5ce09d36-e35e-40cb-9c2e-631ef1c3f82a" alt="" width="214"><figcaption></figcaption></figure></div>

...followed by the **file downloads** option:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FrBp9cEGmIsnOQe3D0vVX%2Fexport%20cross%20ref%20lookup%204.png?alt=media&#x26;token=8f8a95d3-941b-480e-b4d4-3177f0844d28" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 5**\
On the **file downloads** page, you'll find any exports that have been completed for your company profile in the last hour.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &#x20;

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FaYRRqz118vCnnxiOVK1F%2Fexport%20cross%20ref%20lookup%205.png?alt=media&#x26;token=abcbf152-a28a-4ed8-af35-b5d4184d3e05" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
This list may include exports from different parts of the dashboard, not just cross-reference lookups (for example, [run log](https://doc.wearepatchworks.com/product-documentation/process-flows/error-reporting-and-exception-handling/run-logs-and-queue/working-with-run-logs/downloading-run-logs) and [de-dupe data exports](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/de-dupe-shape/working-with-data-pools) are added here).
{% endhint %}

**Step 6**\
Click the **download** button for your job - the associated CSV file is saved to the default downloads folder for your browser.

{% hint style="info" %}
Download files are cleared after one hour. If you don't manage to download your file within this time, don't worry - just run the export again to create a new one.&#x20;
{% endhint %}

## Importing cross-reference lookup values

To import cross-reference lookup values, follow the steps below.&#x20;

**Step 1**\
Log into the Patchworks dashboard, then select **process flows** <mark style="color:orange;">|</mark> **cross-reference lookups** from the left-hand navigation bar.&#x20;

**Step 2**\
Click the name of the cross-reference lookup that you want to update:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FuBwgzBFns4TEC3zAInyY%2Fimport%20cross%20refs%201.png?alt=media&#x26;token=677baa92-1354-459f-ac33-df8a12351ab5" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
Existing values are always checked and updated if matched with your import file. If you don't want to update existing values, don't import them into an existing cross-reference lookup table. Instead, [create a new cross-reference lookup](https://doc.wearepatchworks.com/product-documentation/process-flows/cross-reference-lookups/adding-a-cross-reference-lookup) and import from there.&#x20;
{% endhint %}

**Step 3**\
Move to the lower **values** panel and click the **import values** button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fe4L6TGSg43eGgIgXSC61%2Fimport%20cross%20refs%202.png?alt=media&#x26;token=eff96e89-5365-454f-8b13-2b81fc4263e9" alt=""><figcaption></figcaption></figure></div>

**Step 4**\
Navigate to the CSV file that you want to import and select it:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FmfYnw7YrHBXx1fHTQIF4%2Fimport%20cross%20refs%203.png?alt=media&#x26;token=d0adcf21-58fd-462e-96da-05d1868465cd" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 5**\
The file is uploaded and displayed as a button - click this button to complete the import:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FnBBfwoXiPhtod0nv3bRH%2Fimport%20cross%20refs%204.png?alt=media&#x26;token=9aac8f44-a8d2-4ad4-81b6-3317ca592794" alt=""><figcaption></figcaption></figure></div>

**Step 6**\
The import is completed - existing values are updated and new values are added:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FNBFNYEORay3w0TxjSALx%2Fimport%20cross%20refs%205.png?alt=media&#x26;token=a7e90d7a-5795-44e4-9bc3-2dd3ba939b2a" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You may need to refresh the page to view the updated data pool.
{% endhint %}
