# Custom Categorical (CustomCategoricalGenerator)

The [Custom Categorical](/app/generation/generators/generator-reference/custom-categorical.md) generator is a version of the Categorical generator that selects from values that you provide instead of shuffling the original values.

## Link object structure <a href="#generator-api-custom-categorical-link-object" id="generator-api-custom-categorical-link-object"></a>

The Custom Categorical generator supports linking. It can be made self-consistent or consistent with another column. You cannot configure differential privacy.

The `metadata` object is populated from the [`CustomCategoricalMetadata`](https://app.tonic.ai/apidocs/index.html#/models/CustomCategoricalMetadata) object. You use the `customCategories` field to provide a list of the values to use for the column in the destination database. The values are provided on a single line, separated with newline characters (`\n`). For example, `"Small\nMedium\nLarge"`. To include NULL as an available value, use `{NULL}`.

```json
{
  "schema": "string",
  "table": "string",
  "column": "string",
  "path": "string",  //JSON fields only
  "dataType": "string",  //MongoDB, Amazon DynamoDB, and JSON fields only
  "metadata": {
    "presetId": "string",
    "generatorId": "CustomCategoricalGenerator",
    "customCategories": "value\nvalue",
    "isConsistent": boolean,
    "consistencyColumn": "string",
    "encryptionProcessor": "x-on", //To use configured Structural data encryption
    "customValueProcessor": "string" //If custom value processor applied
  }
}
```

## Example replacement <a href="#generator-api-custom-categorical-replacement" id="generator-api-custom-categorical-replacement"></a>

In this example replacement for the Custom Categorical generator, the values to use are Red, Yellow, Blue, and White. The generator is not linked.

Consistency is disabled.

```json
{
  "name": "color",
  "schema": "public",
  "table": "products",
  "links": [
    {
      "schema": "public",
      "table": "products",
      "column": "color",
      "metadata": {
        "presetID": "CustomCategoricalGenerator",
        "generatorId": "CustomCategoricalGenerator",
        "customCategories": "Red\nYellow\nBlue\nWhite",
        "isConsistent": false
      }
  ]
}
```


---

# 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/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-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.
