# Linking generators

The linking option for a generator allows multiple columns within the same table to use a single generator.

At a high level, consider using linking when columns share a strong interdependency or correlation.

When you link columns, you tell Tonic Structural that the columns are related to each other, and that Structural should take this relationship into account when it generates new data.&#x20;

In a [child workspace](https://docs.tonic.ai/app/workspace/managing-workspaces/workspaces-inheritance), if you change the configuration of a linked column, the columns that it is linked to also are marked as having overrides to the parent workspace configuration.

Note that you cannot configure linking as part of a [generator preset](https://docs.tonic.ai/app/generation/generators-assign-config/generator-presets). You can only configure linking when you configure specific columns.

## Generating data using links

To link columns, you first assign the same generator to those columns.

After you assign the generator, then on the generator configuration panel for any of the columns, use the **Link to** dropdown to link the columns.

The dropdown contains the columns that have the same generator applied. You can link to any or all of those columns.

<figure><img src="https://3378426797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LSQCLFQ4bslJ-HYc8c3%2Fuploads%2F4OO50oAayOY9YngbpmCC%2FLinkedColumnsConfig.png?alt=media&#x26;token=33e0e0b6-7ea3-4bcd-8fb1-4357c976ac6d" alt=""><figcaption><p>Link to dropdown with the available columns to link</p></figcaption></figure>

## Example using categorical generators

Categorical generators support linking and can be used to preserve hierarchical data. Examples of hierarchical data include:

* City, State, Zip
* Job Title, Department
* Day of Month, Month, Year&#x20;

To illustrate how linking works, we'll use an example of city and state columns. Here is the original data:

![Original city and state data](https://3378426797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LSQCLFQ4bslJ-HYc8c3%2Fuploads%2FzgMNtqbtnpgFOqhln3c8%2FLinkedColumnsOriginalData.png?alt=media\&token=f28b3e26-9704-43e5-a20f-07d7f795141c)

The below image shows the results when you apply the Address generator to city and state columns, but do not link the columns. Because the columns are not linked, the values in each column are shuffled independently. In the output, the city and state combinations are not valid. For example, Chicago is not in Arizona and Phoenix is not in New York.

![An unlinked categorical generator applied to city and state columns](https://3378426797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LSQCLFQ4bslJ-HYc8c3%2Fuploads%2FPiEPlLwpRAwBwkE7dWx8%2FLinkedColumns_OutputWithoutLinks.png?alt=media\&token=896a97b5-7717-467d-9232-77e396f02070)

The next image shows the results when you apply the Address generator to and link the city and state columns. This preserves the data hierarchy and ensures that the city and state combinations are valid.

![A linked categorical generator applied to city and state columns](https://3378426797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LSQCLFQ4bslJ-HYc8c3%2Fuploads%2FNEDxWvzdwMAX1cWwiM1f%2FLinkedColumns_OutputAfterLinking.png?alt=media\&token=3f62ff43-61cd-4426-8330-5aab32a9822f)

## Generators that support linking

The following generators can be linked:

* [Address](https://docs.tonic.ai/app/generation/generators/generator-reference/address)
* [Algebraic](https://docs.tonic.ai/app/generation/generators/generator-reference/algebraic)
* [Categorical](https://docs.tonic.ai/app/generation/generators/generator-reference/categorical)
* [Continuous](https://docs.tonic.ai/app/generation/generators/generator-reference/continuous)
* [Event Timestamps](https://docs.tonic.ai/app/generation/generators/generator-reference/event-timestamps)
* [Sequential Integer](https://docs.tonic.ai/app/generation/generators/generator-reference/sequential-integer)


---

# 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.tonic.ai/app/generation/generators/generator-characteristics/linking-generators.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.
