# Custom Categorical

A version of the [Categorical](https://docs.tonic.ai/app/generation/generators/generator-reference/categorical) generator that selects from values that you provide instead of shuffling the original values.

## Characteristics <a href="#custom-categorical-characteristics" id="custom-categorical-characteristics"></a>

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><strong>Consistency</strong></td><td valign="top">Yes, can be made self-consistent or consistent with another column.</td></tr><tr><td valign="top"><strong>Linking</strong></td><td valign="top">Yes, can be linked.</td></tr><tr><td valign="top"><strong>Differential privacy</strong></td><td valign="top">Yes, if consistency is not enabled.</td></tr><tr><td valign="top"><strong>Data-free</strong></td><td valign="top">Yes, if consistency is not enabled.</td></tr><tr><td valign="top"><strong>Allowed for primary keys</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Allowed for unique columns</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Uses format-preserving encryption (FPE)</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Privacy ranking</strong></td><td valign="top"><ul><li>1 if not consistent</li><li>4 if consistent</li></ul></td></tr><tr><td valign="top"><strong>Generator ID (for the API)</strong></td><td valign="top"><a href="../../../api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-custom-categorical"><code>CustomCategoricalGenerator</code></a></td></tr></tbody></table>

## How to configure <a href="#custom-categorical-configure" id="custom-categorical-configure"></a>

### Linking the column

From the **Link To** dropdown list, select the columns to link this column to.

You can only select other columns that use the Custom Categorical generator.

### **Providing the values to use**

In the **Custom Categories** text area, provide the list of values that the generator can choose from.

To provide the values, you can either:

* Enter the values manually
* Provide an AI prompt to populate the values (Structural Cloud only)

#### **Entering the values manually**

When you enter the values manually, put each value on a separate line.

To add a NULL value to the list, use the keyword `{NULL}`.

#### **Providing an AI prompt**

{% hint style="info" %}
Only available on the Structural Cloud instance that is hosted in the United States, and on self-hosted instances that [enable Structural AI features](https://docs.tonic.ai/app/admin/structural-ai-use/connecting-a-self-hosted-instance-to-an-llm). Not available on the European instance of Structural Cloud.
{% endhint %}

To use an AI prompt to create the values:

1. In the AI prompt field below the **Custom Categories** text area, type the prompt to use to create the values.\
   \
   The prompt can include the number of values to create. For example, `10 names of flowers` or `20 cities in California`.\
   \
   If the prompt does not include a number, then Structural determines a reasonable set of values to generate based on the prompt. If there is a very limited set of values, then Structural often generates the full set of values. Otherwise it attempts to generate a reasonable number of values, usually between 10 and 20.
2. Press **Enter** or click the add values icon.

The values replace any existing values in the list.

After you use the prompt to create a set of values, you can edit the list manually.

For information about how Structural uses AI, go to [structural-ai-use](https://docs.tonic.ai/app/admin/structural-ai-use "mention").

### **Configuring consistency**

Toggle the **Consistency** setting to indicate whether to make the column consistent.

By default, consistency is disabled.

If you enable consistency, then by default the generator is self-consistent.

To make the generator consistent with another column, from the **Consistent to** dropdown list, select the column.

When a generator is self-consistent, then a given value in the source database is always mapped to the same value in the destination database.

When a generator is consistent with another column, then a given source value in that column always results in the same value for the current column in the destination database. For example, a department column is consistent with a username column. For each instance of User1 in the source database, the value in the department column is the same.

### Enabling Structural data encryption

If [Structural data encryption](https://docs.tonic.ai/app/generation/generators-assign-config/generators-data-encryption-config) is enabled, then to use it for this column, in the advanced options section, toggle **Use data encryption process** to the on position.


---

# 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-reference/custom-categorical.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.
