> For the complete documentation index, see [llms.txt](https://stage-precision.gitbook.io/grid/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stage-precision.gitbook.io/grid/touch-designer-integration/parameter-control/text-example.md).

# Text Example

Receive a String named title from Grid Studio and display its latest value in a TouchDesigner Text TOP.

## Display text from Grid Studio

This example sends a String named `title` from Grid Studio to TouchDesigner.

The SPNet Generic DAT receives the text. A parameter expression connects its value to a Text TOP.

### 1. Prepare Grid Studio

Use the setup described in **Send parameter values from Grid Studio**.

Add an SPNet String send action to a Workflow and configure:

| Setting           | Value          |
| ----------------- | -------------- |
| Name              | `title`        |
| Type              | String         |
| Value             | `Welcome`      |
| SPNet destination | `237.37.37.37` |
| UDP port          | `37373`        |

Start the SPNet Sender. Execute the action after the TouchDesigner receiver is ready.

### 2. Add the SPNet Generic DAT

In `/project1`:

1. Add the **DAT version of SPNet Generic** from the Custom operators.
2. Rename it to `spnet_text`.
3. On its **Data** page, configure:

| Parameter   | Value       |
| ----------- | ----------- |
| Output Mode | `Live Data` |
| Data Type   | `String`    |
| Name Filter | `title`     |
| Timeout ms  | `0`         |

On the **Connection** page, use:

| Parameter         | Value          |
| ----------------- | -------------- |
| Port              | `37373`        |
| Bind Address      | `0.0.0.0`      |
| Multicast Group   | `237.37.37.37` |
| Interface Address | `0.0.0.0`      |

{% hint style="info" %}
Name Filter is case-sensitive. The outgoing name and filter must both use title with the same capitalization.
{% endhint %}

### 3. Receive the first String

Execute the send action in Grid Studio.

The DAT should contain a row similar to this:

| name  | type   | value   | x | y | z | w | age\_ms |
| ----- | ------ | ------- | - | - | - | - | ------- |
| title | string | Welcome |   |   |   |   | 25      |

The text is stored in the **value** column.

The `age_ms` value shows the time since this named value was last received. It increases between updates.

### 4. Create the Text TOP

In `/project1`:

1. Create a **Text TOP** named `title_text`.
2. Set its resolution to a size such as `512 × 128`.
3. Choose a readable font size and alignment.
4. Set its **Text** parameter to **Python Expression** mode.
5. Enter:

```python
op('spnet_text')['title', 'value'].val if op('spnet_text')['title', 'value'] is not None else ''
```

The expression finds the row named `title` and reads its `value` cell.

If that row is unavailable, it returns an empty string so the Text TOP remains blank.

{% hint style="info" %}
This relative reference assumes spnet\_text and title\_text are in the same network, as they are in this example.
{% endhint %}

### 5. Add an output

Create a **Null TOP** named `title_out` and connect:

```
title_text → title_out
```

View `title_out`.

You should now see `Welcome`.

### 6. Test different titles

Change the outgoing String in Grid Studio and execute the send action again.

| Sent value     | Displayed text |
| -------------- | -------------- |
| `Welcome`      | Welcome        |
| `Standby`      | Standby        |
| `Show running` | Show running   |

Each update replaces the previous value in the `title` row, and the Text TOP follows automatically.

{% hint style="info" %}
Timeout is set to zero, so the latest title remains available between updates, including when the Workflow sends it only once.
{% endhint %}

With a positive timeout, the row disappears after its own receive age exceeds that duration. The expression then returns an empty string.

### Check the result

Follow the text through:

```
Grid Studio String Action
    → SPNet Generic DAT: title / value
    → Text TOP
    → Null TOP
```

If the title row is missing, check the String type, name filter, connection settings, and whether the send action has executed.

If the DAT contains the correct text but the Text TOP is blank or shows an error, check the node name, the Python Expression mode, and the font settings.
