> ## Documentation Index
> Fetch the complete documentation index at: https://docs.repdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Assign values automatically with a lookup table

> Instead of writing conditions for every possible embedded variable answer, you can upload a file that maps each response to the value you want assigned.

Instead of writing conditions for every possible embedded variable answer, you can upload a file that maps each response to the value you want assigned.

#### What's on this page:

1. When to use a lookup table to define variable values
2. How to set up the lookup table file
3. How to set up variables based on a lookup table
4. Troubleshooting

### When to use a lookup table to define variable values

Lookup tables can be useful to define embedded variable values when there are many possible values, and manually creating the rules for each would ordinarily be time consuming. A common use is geography: you can ask respondents to enter their ZIP code, and then assign matching regions, states, or cities based on a ZIP code mapping.

> [!WARNING]
>
> Note: the lookup table solution only works if value conditions are only based on one question. If values are based on answers to multiple questions (not just one), their conditions must be set up manually in the embedded variable configuration.

### How to set up the lookup table file

**1. Add the question that collects the value.**

The lookup table matches against an answer given earlier in the survey, so that question has to exist first and sit ahead of the embedded variable in the survey flow.

**2. Prepare your file.**

Your file must contain at least two columns:

* **Value to match:** possible answers to the source question, one row per value
* **Assigned value:** what SightX should assign when that value is entered

File requirements and tips:

* The file must be in CSV or XLSX format
* Include a header row; the column names don't matter, but you'll use them to identify the columns after upload.
* Values have to match what respondents actually enter in the source question. Watch out for ZIP codes with leading zeros, which Excel drops unless the column is formatted as text.
* The value to match column should not contain duplicates.

### Set up the lookup table

**Step 1. Add an embedded variable to your survey build**

**Step 2. Select the Lookup table method and choose source question**

Under **Define values**, switch from **Manual rules** to **Lookup table**.

![Assign values automatically with a lookup table](https://mintcdn.com/repdata/hom161JVbOBRG4aK/public/sightx/knowledge-base/assign-values-automatically-with-a-lookup-table-screenshot-2026-09-22-at-11.22.29-am.png?fit=max\&auto=format\&n=hom161JVbOBRG4aK\&q=85\&s=450bb01257cebde43d660f8803741020)

**Step 3. Choose what to match on**

Set **Match values from** to the type of object the response is sourced from (survey question, another embedded variable, etc), then select the specific question or variable in the second dropdown.

**Step 4. Upload your file**

Drag your CSV or XLSX into the upload area, or click **browse** and select it.

**Step 5. Map your columns**

SightX reads the headers from your file and asks which column holds the values to match and which holds the values to assign. Set both, then click **Import lookup table**.

![Assign values automatically with a lookup table](https://mintcdn.com/repdata/hom161JVbOBRG4aK/public/sightx/knowledge-base/assign-values-automatically-with-a-lookup-table-screenshot-2026-09-22-at-11.28.28-am.png?fit=max\&auto=format\&n=hom161JVbOBRG4aK\&q=85\&s=0afac1436a36caf6dbb2c7acb52049a0)

**Step 6. Review the import**

When the import finishes, a confirmation banner shows how many values were matched.

Use the **See** dropdown to review the results:

* **Issues:** rows that could not be imported or matched. Aim for zero here.
* **All rows:** every row in the file with its assigned value and status. Use the search box to spot check individual values.
* **Unique assigned values:** each distinct value your table assigns, with a count of how many rows map to it. This is a quick way to confirm your groupings look right, for example four regions rather than five because of a typo.

![Assign values automatically with a lookup table](https://mintcdn.com/repdata/hom161JVbOBRG4aK/public/sightx/knowledge-base/assign-values-automatically-with-a-lookup-table-screenshot-2026-09-22-at-11.31.00-am.png?fit=max\&auto=format\&n=hom161JVbOBRG4aK\&q=85\&s=2ba0f33a93903dabb3a60c57939fd583)

**Step 7. Define what should happen when there is no match**

In the dropdown **If none of the above conditions are met, assign the value**, choose what variable value should be assigned when there is no match in the table. Selecting "Other value" lets you type in a new value to assign, such as `None` or `Unknown`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.