# Replacement cross-reference lookups

## Introduction

Having [chosen to configure cross-reference lookup replacements for a virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements/..#configuring-replacements-for-a-virtual-environment-version), a new replacement rule is displayed, ready for you to configure:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FXxfYqaz6ge0CaVtRffOl%2Freplace%20cross%20refs%201.png?alt=media&#x26;token=7dc9aab2-5e2e-46f3-86f9-aa124417559c" alt=""><figcaption></figcaption></figure>

Having defined the first rule, you can add more - you must create one replacement rule for every [cross-reference lookup table](https://doc.wearepatchworks.com/product-documentation/process-flows/cross-reference-lookups) that you need to replace in every process flow that will run in this environment.&#x20;

## Defining replacement rules for a cross-reference lookup

{% stepper %}
{% step %}
**Select the required ORIGINAL cross-reference lookup**

Use the `original` dropdown list to select the first cross-reference lookup in a 'master' process flow that must be replaced when this process flow runs in the given virtual environment - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F7Vvc2HrsazoEAFqh5toZ%2Freplace%20cross%20refs%202.png?alt=media&#x26;token=98116cdc-1aeb-4166-aff6-4ae7c6341ef7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
As you work through your replacement configuration, it's helpful to view related ['master' process flows](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/creating-a-master-process-flow) in another browser tab. You can duplicate a Patchworks browser tab and navigate to a different page whenever needed.
{% endhint %}
{% endstep %}

{% step %}
**Select the required REPLACEMENT cross-reference lookup**

Use the `replacement` dropdown list to select the replacement cross-reference lookup that must be used when this process flow runs in the given virtual environment - 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%2FWCfQc9YzHsjG2kgFIf1F%2Freplace%20cross%20refs%203a.png?alt=media&#x26;token=d76b8c59-c22b-4944-b885-cd0ab836d4bc" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Confirm your selections**

Click the `create` button (associated with this replacement rule) to confirm your selections:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FtFDx0XFy9HByqDvDnAjX%2Freplace%20cross%20refs%204a.png?alt=media&#x26;token=6393df02-d325-43c2-bb2f-885569109b3f" alt=""><figcaption></figcaption></figure>

The rule is added:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F1jtmr4YruCmMztRKNafM%2Freplace%20cross%20refs%205a.png?alt=media&#x26;token=c7aeeaf9-eb63-4c6e-853d-d2c39115fc0a" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Once a rule is confirmed, it can't be edited. If you need to change a replacement rule, use the 'trash' icon to remove it and add a new one.
{% endhint %}
{% endstep %}

{% step %}
**Add more replacement rules for cross-reference lookups**

To add another replacement rule for a cross-reference lookup, click the top-right `create` button:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F0Z3cNG4VclqCerIy0odO%2Freplace%20cross%20refs%206a.png?alt=media&#x26;token=8360d7a4-27be-4811-be10-2675a49654c3" alt=""><figcaption></figcaption></figure>

Update the new rule as required, then click the associated `create` button to confirm your selections:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPnxVoF3yxs0Hf7MN4uCq%2Freplace%20cross%20refs%207a.png?alt=media&#x26;token=c67a168d-a0a8-4b09-8d1b-b60eb4284cb8" alt=""><figcaption></figcaption></figure>

Repeat as many times as needed to define all required cross-reference lookup replacements for all process flows that will be running in this virtual environment.

{% hint style="info" %}
If you don't want to define ALL cross-reference lookup replacements now, that's OK. For example, you might choose to add the minimum number of replacements needed for [testing](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/testing-a-process-flow-against-a-virtual-environment), then define remaining rules (in a [new draft](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/understanding-virtual-environment-versions)) later, after initial testing is complete.
{% endhint %}
{% endstep %}
{% endstepper %}
