# Conditional

This is a [composite generator](https://docs.tonic.ai/app/generation/generators/generator-types/generators-composite).

Applies different generators to the value conditionally based on any value in the table.

For example, a Users table contains Name, Username, and Role columns. For the Username column, you can use a conditional generator to indicate that if the value of Role is something other than Test, then use the Character Scramble generator for the Username value. For Test users, the name is not masked.

## Characteristics <a href="#conditional-characteristics" id="conditional-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">Determined by the selected generators.</td></tr><tr><td valign="top"><strong>Linking</strong></td><td valign="top">Determined by the selected generators.</td></tr><tr><td valign="top"><strong>Differential privacy</strong></td><td valign="top">Determined by the selected generators.</td></tr><tr><td valign="top"><strong>Data-free</strong></td><td valign="top">Determined by the selected generators.</td></tr><tr><td valign="top"><strong>Allowed for primary keys</strong></td><td valign="top"><p>Yes, but:</p><ul><li>Make sure that the configuration preserves uniqueness.</li><li>Do not use on primary key columns that are used for subsetting.</li></ul></td></tr><tr><td valign="top"><strong>Allowed for unique columns</strong></td><td valign="top">Yes</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>If a fallback generator is selected, then the lower of either 5 or the fallback generator.</li><li>5 if no fallback generator is selected</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-conditional"><code>ConditionalGenerator</code></a></td></tr></tbody></table>

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

The generator consists of a list of options. Each option includes the required conditions and the generator to use if those conditions are met.

### Setting the default generator <a href="#conditional-default-generator" id="conditional-default-generator"></a>

The generator always contains a **Default** option. The **Default** option is used if the value does not meet any of the conditions. To configure the **Default** option:

1. From the **Default** dropdown list, select the generator to use by default.
2. Configure the selected generator.

### Adding a condition option <a href="#conditional-add-condition" id="conditional-add-condition"></a>

To add a condition option:

1. Click **+ Conditional Generator**.
2. To add a condition:

   1. Click **+ Condition**.
   2. From the column list, select the column for which to check the value.
   3. Select the comparison type.
   4. Enter the column value to check for.

   To remove a condition, click the delete icon for the condition.
3. From the **Generator** dropdown list, select the generator to run on the current column if the conditions are met.\
   \
   You cannot select another composite generator.
4. Choose the configuration options for the selected generator.

### Viewing and editing condition options <a href="#conditional-view-edit-condition" id="conditional-view-edit-condition"></a>

To view details for and edit a condition option, click the expand icon for that option.

### Removing a condition option <a href="#conditional-remove-condition" id="conditional-remove-condition"></a>

To remove a condition option, click the delete icon for the option.


---

# 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/conditional.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.
