# Composite generators

Most Tonic Structural generators consume source data and perform an operation on it to produce destination data.

For example, the Character Scramble generator takes the original data from the source database, replaces the letters and numbers with random letters and numbers, and then writes the result to the destination database.

Composite generators do not generate data directly. Instead, they apply other generators, referred to as sub-generators, to specific sub-values within the column or based on conditions.

## Available composite generators <a href="#composite-gen-list" id="composite-gen-list"></a>

Structural provides the following composite generators:

* [Array JSON Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/array-json-mask)
* [Array Regex Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/array-regex-mask)
* [Conditional](https://docs.tonic.ai/app/generation/generators/generator-reference/conditional)
* [CSV Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/csv-mask)
* [HStore Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/hstore-mask)
* [HTML Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/html-mask)
* [JSON Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/json-mask)
* [Regex Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/regex-mask)
* [Struct Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/struct-mask)
* [XML Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/xml-mask)

## How composite generators work <a href="#composite-generators-how-they-work" id="composite-generators-how-they-work"></a>

Most composite generators treat the input as structured data that the generator parses using a domain-specific syntax, such as:

* XPath for XML or HTML
* JSONPath for JSON or a Spark StructType
* Regular expressions for text

These generators allow you to select a sub-value of the input, and then configure a specific generator to apply to only that sub-value. This means that you can take your original structured data and selectively mask the content.

For example, for the following structured content:

`{ name: { first: "Tj", last: "Bass" } }`

You indicate to use the Name generator to replace the value of `last`. The result is something like:

`{ name: { first: "Tj", last: "Pine" } }`

The Conditional generator is slightly different. It allows you to apply a specific generator when the column value matches a specific condition. For example, you can indicate to apply a Character Scramble generator only if the column value is something other than "test".

## Composite generator limitations <a href="#composite-generators-limitations" id="composite-generators-limitations"></a>

### Cannot configure generator presets from Generator Presets <a href="#composite-gen-preset-config" id="composite-gen-preset-config"></a>

You cannot configure generator presets for composite generators from the **Generator Presets** view. The **Generator Presets** view does not have access to data to use for path expressions or conditions.

From a column configuration panel, you can save the current configuration as the new baseline configuration, and reset the configuration to the current baseline.

### Composite generators cannot be sub-generators <a href="#composite-gen-not-sub-gen" id="composite-gen-not-sub-gen"></a>

For any composite generator, when you select the generator to apply to a selected sub-value or based on a specified condition, you cannot select another composite generator.

For example, you cannot apply a Conditional or XML Mask generator to the value of a specified path expression.

### No sub-generator consistency with other columns <a href="#composite-gen-sub-gen-consistency" id="composite-gen-sub-gen-consistency"></a>

For composite generators other than the Conditional or Regex Mask generators, you cannot configure a sub-generator to be consistent with another column.


---

# 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-types/generators-composite.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.
