> For the complete documentation index, see [llms.txt](https://docs.struct.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.struct.com/reference/settings/additional-information/name-building.md).

# Name building

Define how attributes are rendered in the backoffice

Name building improves readability and helps identify values in complex attributes and written results from concatenate business-rule actions. Clear, consistent names help users recognise records and understand their key values quickly. An effective setup keeps the backoffice user-friendly and simplifies rule maintenance.

### Render pattern in backoffice

When it backoffice you can configure the render pattern of values on a complex attribute. If we navigate to a global list "Brand" we can select the attributes we want to be rendered along with their pattern.&#x20;

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FMtpxR4i3e8A3MTHKtoWp%2Fimage.png?alt=media&amp;token=eea2484f-5087-499c-b464-8fc7db7ad33f" alt=""><figcaption></figcaption></figure>

Afterwards, when selecting one of the values from the global list on a product, the value is displayed using the defined render pattern. In this example, **Name**, **Phone**, and **Email** are rendered according to the pattern.

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FfFp4dHoCiEq7nzFpozXI%2Fimage.png?alt=media&amp;token=7e1affde-dfe4-4604-921a-6d6ccdb6a3f9" alt=""><figcaption></figcaption></figure>

If `{2}` (Email) is empty, the static text before `{2}` is removed automatically.

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FWw3q6B12zvwZsRy8dF2w%2Fimage.png?alt=media&amp;token=05ec8153-05d3-483f-a488-f476d057ac6b" alt=""><figcaption></figcaption></figure>

However, if `{1}` (Phone) is empty, the static text between `{0}` (Name) and `{1}` is not removed because `{1}` is positioned after the text that should be removed.

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FFhKkZyAEL13y2A8kMU8A%2Fimage.png?alt=media&amp;token=8f1c3956-874c-4e39-9bb5-0f5466f7adc0" alt=""><figcaption></figcaption></figure>

To remove static text in this situation, `*` can be added after the static text before the attribute, for example `Phone:*{1}`. This makes the static text conditional on the preceding attribute `{0}` having a value. So if `{0}` (Name) is empty then the " - Phone:" static text is removed.

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FPR4VGLCUhHleg3gmzJw1%2Fimage.png?alt=media&amp;token=bac2802c-c9ab-42c3-b4eb-9a55091db520" alt=""><figcaption></figcaption></figure>

### Render patterns

Render patterns define how selected attributes are combined and rendered when building a name.

A render pattern consists of one or more attribute placeholders and optional static text. Placeholders refer to selected attributes by their position.

For example, if Name and SKU are selected:

```
{0}-{1}
```

Here the value will be rendered as:

```
Product A-12345
```

### Placeholders

Use `{n}` to add a selected attribute to the rendered name. `n` corresponds to the position of the attribute in the selected attributes.

For example:

| Selected attributes | Pattern            | Result                     |
| ------------------- | ------------------ | -------------------------- |
| Name, SKU           | `{0}-{1}`          | `Product A-12345`          |
| Name, SKU           | `Name:{0} SKU:{1}` | `Name:Product A SKU:12345` |
| Name, SKU, Colour   | `{0} - {1} - {2}`  | `Product A - 12345 - Blue` |

The position of each placeholder corresponds to the order of the selected attributes. `{0}` refers to the first attribute, `{1}` to the second attribute, and so on.

### Static text

Static text can be added to a pattern in addition to attribute placeholders.

For example:

```
Name:{0} SKU:{1}
```

With Name set to `Product A` and **SKU** set to `12345`, the result is:

```
Name:Product A SKU:12345
```

Static text is rendered as defined and can be used to add labels, separators, or other formatting.

### Conditional static text

The `*` can be used when static text should be removed if the previous optional value is missing. This is useful when several optional attributes are combined into one readable value.

For example, a product could contain a Brand, Model, and Size:

```
{0} {1} Size:{2}
```

When all values are available:

```
Acme Running Shoe Size:42
```

If the Model `{1}` is missing, the text following it is still rendered because the Size `{2}` has a value

```
Acme Size:42
```

If the intention is that the Size should only be shown when the Model is available, `*` can be added after the static text:

```
{0} {1} Size:*{2}
```

Now, when `{1}` is missing, the static text between `{1}` and `{2}` is removed:

```
Acme 42
```

This allows the render pattern to control which static text is displayed when values are missing.

### Conditional rendering

Use `[? ... ]` to make part of a pattern conditional.

A conditional section is rendered only when its referenced attribute has a value. This allows labels and other static text to be included only when the corresponding value is available.

For example:

```
[?Name:{0} SKU:]{1}
```

When Name and SKU are set, the result is:

```
Name:Product A SKU:12345
```

When Name is empty, the conditional section is not rendered:

```
12345
```

Conditional rendering is useful when several pieces of static text belong together and should only be rendered when a particular attribute is available.

### Examples

#### Simple separator

```
{0}-{1}
```

Result:

```
Product A-12345
```

#### Labeled values

```
Name:{0} SKU:{1}
```

Result:

```
Name:Product A SKU:12345
```

#### Conditional static text

```
{0} SKU:{1} -* {2}
```

Result when SKU is present:

```
Product A SKU:12345 - Blue
```

Result when SKU is empty:

```
Product A SKU:Blue
```

#### Conditional section

```
[?Name:{0} SKU:]{1}
```

Result when Name is present:

```
Name:Product A SKU:12345
```

Result when Name is empty:

```
12345
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.struct.com/reference/settings/additional-information/name-building.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
