# CSV Mask

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

Masks text columns by parsing the values as rows whose columns are delimited by a specified character.

You can assign specific generators to specific indexes. You can also use the generator that is assigned to a specific index as the default. This applies the generator to every index that does not have an assigned generator.

The output value maintains the quotes around the index values.

For example, a column contains the following value:

`"first","second","third"`

You assign the Character Scramble generator to index 0 and assign Passthrough to index 2. You select index 0 as the index to use for the default generator.

In the output, the first and second values are masked by the Character Scramble generator. The third value is not masked. The output looks something like:

`"wmcop", "xjorsl", "third"`

## Characteristics <a href="#csv-mask-characteristics" id="csv-mask-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 sub-generators.</td></tr><tr><td valign="top"><strong>Linking</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Differential privacy</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Data-free</strong></td><td valign="top">Determined by the selected sub-generators.</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">5</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-csv-mask"><code>CsvMaskGenerator</code></a></td></tr></tbody></table>

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

### Setting the delimiter <a href="#csv-mask-delimiter" id="csv-mask-delimiter"></a>

In the **Delimiter** field, type the delimiter that is used as a separator in the value.

For example, for the value `"first","second","third"`, the delimiter is a comma.

### Adding a sub-generator <a href="#csv-mask-add-sub-generator" id="csv-mask-add-sub-generator"></a>

You can configure a generator for any or all of the indexes. To add a sub-generator for an index:

1. Under **Sub-Generators**, click **Add Generator**.\
   \
   On the add generator dialog, the **Cell CSV** field contains a sample value from the source data. You can use the navigation icons to page through the values.
2. In the **CSV Index** field, type the index to assign a generator to.\
   \
   The index numbers start with 0.\
   \
   You cannot use an index that already has an assigned generator.\
   \
   **Matched CSV values** shows the value at that index for the current sample column value.
3. Under **Generator Configuration**, from the **Select a Generator** dropdown list, select the generator to use for the selected index.\
   \
   You cannot select another composite generator.\
   \
   To remove the selection, click the delete icon.
4. Configure the selected generator.\
   \
   You cannot configure the selected generator to be consistent with another column.
5. To save the configuration and immediately add a generator for another index, click **Save and Add Another**.\
   \
   To save the configuration and close the add generator panel, click **Save**.

### Managing the sub-generator list <a href="#csv-mask-manage-sub-generators" id="csv-mask-manage-sub-generators"></a>

From the **Sub-Generators** list:

* To edit a generator assignment, click the edit icon.
* To remove a generator assignment, click the delete icon.
* To move a generator assignment up or down in the list, click the up or down arrow.

### Setting the default for indexes without a generator <a href="#csv-mask-default-generator-index" id="csv-mask-default-generator-index"></a>

After you configure a generator for at least one index, the **Default Link** dropdown list is displayed.

From the **Default Link** dropdown list, select the index to use to determine how to mask values for indexes that do not have an assigned generator.

For example, you assign the Character Scramble generator to index 2. If you set **Default Link** to 2, then all indexes that do not have an assigned generator use the Character Scramble generator.
