> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voxworks.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Collection - Name, Date of Birth, Phone & Alphanumeric

> Four single-purpose composite tools that each collect and verify one value by voice (a name, a date of birth, a phone number or an alphanumeric reference), with look-back, format checks and attempt limits.

## What they do

Four composite tools each collect **one** value from the caller by voice and verify it before saving it:

| Tool                                | Collects                                              | Verification                                                                                    |
| ----------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| **Data Collection - Name**          | One name: a first name *or* a last name, never both   | Read-back to confirm, plus optional letter-by-letter spelling                                   |
| **Data Collection - Date of Birth** | One date                                              | Read-back to confirm. If the caller gives only part of the date, the missing part is asked for. |
| **Data Collection - Phone**         | One phone number                                      | Read-back to confirm, digit by digit. The number is formatted and checked before it is saved.   |
| **Data Collection - Alphanumeric**  | One reference, policy number, registration or similar | Read-back to confirm, character by character, with an optional format check                     |

They are single-purpose versions of [Data Collection - v0.2](/tools/composite/data-collection). Instead of choosing a **Type**, you pick the tool that matches the data. Each adds features the general tool doesn't have: picking up a value the caller already said earlier in the call (**Lookback**), a configurable attempt limit, a custom give-up line and, on Alphanumeric, a way to strip prefixes and stray words from the value.

Each is a [composite tool](/tools/composite-tools): the whole exchange runs behind a single step. Use one step per value. To collect a first and a last name, place two **Data Collection - Name** steps.

***

## How a collection runs

Every use enters through the same checks, in this order:

1. **Skip If Set.** If the referenced variable already holds a real value, the step ends at once with a true result. Nothing is spoken.
2. **Existing Value.** If a pre-populated value is supplied, the assistant confirms it instead of asking fresh: "I have your last name as Smith, is that right?"
3. **Lookback.** If **Lookback** is on, the recent conversation is checked for a value the caller already said, for example "Hi, it's Jane Smith" when collecting the last name. A hit is confirmed the same way as an Existing Value.
4. **Fresh ask.** Otherwise the assistant asks for the value, using **First Message** if you set one.

From there the confirmation, spelling and correction loops run as the tool requires. Each stage (asking, confirming, spelling) is limited to **Max Attempts** tries. When the limit is reached the assistant says a short move-on line ("That's okay, let's move on.", or your **Move On Line**) and the step finishes false. After a successful capture the assistant says a short acknowledgement such as "Noted." unless **Skip Moving On** is on.

***

## Inputs

### Common to all four tools

| Setting               | Description                                                                                                                                                                                                                                                                                    | Default                                    |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| **Field Description** | What is being collected, spoken inside the question. Use lower case, for example `first name`, `date of birth`, `mobile number` or `policy number`. One field only. Required.                                                                                                                  | —                                          |
| **Existing Value**    | A pre-populated value, typically a contact field such as `{{contact.first_name}}` (string, e.g. `Jane`). When present, the assistant confirms it rather than asking fresh.                                                                                                                     | —                                          |
| **Skip If Set**       | A variable reference, usually the same variable the output is mapped to. If it holds a real value, the step ends at once with a true result and nothing is spoken.                                                                                                                             | —                                          |
| **First Message**     | A custom opening line for the first ask when there is no existing value.                                                                                                                                                                                                                       | Standard wording                           |
| **Data Context**      | Background the assistant can use to answer the caller's questions about the field (for example, why it's needed), and may share when it helps.                                                                                                                                                 | —                                          |
| **Custom Keywords**   | Extra comma-separated words for the speech recogniser to listen for on this field, added to the tool's built-in set. See [Key Terms](/conversation-dynamics/keywords).                                                                                                                         | —                                          |
| **Skip Moving On**    | When on, a successful capture ends silently instead of with the short acknowledgement. Useful when collecting several fields back to back. It never silences the give-up line or the apology after a technical failure.                                                                        | Off                                        |
| **Max Attempts**      | Total tries at each stage (asking, confirming, spelling). The default 5 means one ask plus up to four re-asks. Each stage has its own count.                                                                                                                                                   | `5`                                        |
| **Lookback**          | How much of the conversation to check, once at the start, for a value the caller has already said: **None**, **Last 2**, **Last 4**, **Last 6**, **Last 8**, **Last 10** or **Full**. "Last N" counts individual messages from either side. An Existing Value always wins over a Lookback hit. | None                                       |
| **Lookback Ignore**   | Values the Lookback must never pick up, comma-separated. Normally the variables holding fields you have already collected, so a phone number the caller just gave isn't picked up as this field. Matching ignores case, spaces and punctuation.                                                | —                                          |
| **Move On Line**      | Replaces the line spoken when the tool gives up on the field. It is spoken word for word, so write one finished statement. It must not end in a question mark. To vary it, pass a `<<rand-pick[...]>>` list as the value (see [Script Text Functions](/scripts/text-functions)).               | "That's okay, let's move on." and variants |

<Warning>
  **Data Context** and **Move On Line** carry over between uses within a call: a later Data Collection step that leaves one blank keeps the previous step's value. Once any step in a call sets either, set it on every Data Collection step in that call, passing an empty value where you want none / the default wording.
</Warning>

### Data Collection - Name

| Setting     | Description                                                             | Default |
| ----------- | ----------------------------------------------------------------------- | ------- |
| **Confirm** | Read the name back and ask the caller to confirm it.                    | On      |
| **Spell**   | Ask the caller to spell the name, then spell it back for a final check. | Off     |

### Data Collection - Date of Birth, Phone and Alphanumeric

| Setting   | Description                                                                                                               | Default |
| --------- | ------------------------------------------------------------------------------------------------------------------------- | ------- |
| **Check** | Read the value back and ask the caller to confirm it before it is saved. Turn it off to save the value with no read-back. | On      |

### Data Collection - Alphanumeric only

| Setting            | Description                                                                                                                                                                                                                                                                                                                                                     | Default |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| **Format Pattern** | An optional regular expression the value must match before it is read back or saved. Start it with `^` and end it with `$`, for example `^[A-Za-z]{3}[0-9]{3}$` for three letters then three digits. Without them, any value that merely *contains* a match is accepted. When the value doesn't match, the assistant asks again.                                | —       |
| **Format Hint**    | A short description of the expected shape, such as `6 letters and numbers`, used in the re-ask when the value doesn't match **Format Pattern**.                                                                                                                                                                                                                 | —       |
| **Keep Pattern**   | An optional regular expression describing the value itself, used to strip anything around it. For example, `2[0-9]{6}` turns `Q-2600114` into `2600114`. It is applied before the format check and the read-back, so what is stored and what the caller hears match. Normally written *without* `^` and `$`. When nothing matches, the value is left unchanged. | —       |

Test your patterns before using them. A pattern that isn't valid ends the collection through the failure path on a live call.

***

## Outputs

| Output              | Description                                                                                                                                                   |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **result**          | Hidden boolean that routes the step. True when a value was collected (or Skip If Set fired). False when the caller declined or the attempt limit was reached. |
| **Collected Value** | The confirmed value as a string. Map it to a durable variable, usually the matching contact field, in **Output mapping**.                                     |

## Variables these tools write

| Variable                            | Type   | Example | Description                                                                                            |
| ----------------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------ |
| `{{data_collection.output_result}}` | string | `Smith` | The confirmed value, the source of the **Collected Value** output. Empty when the tool finishes false. |

All four tools share the `data_collection` namespace with Data Collection - v0.2, and each use overwrites it. Always map **Collected Value** to a contact field or custom variable rather than reading `{{data_collection.output_result}}` in later steps.

***

## Routing and wiring tips

* **true**: the value was collected (or skipped because it was already set). **Otherwise**: the caller declined or the attempt limit was reached.
* For an optional field, point true and Otherwise at the same next step so a failed collection never blocks the call.
* Wire **Existing Value** and **Skip If Set** to the field you are collecting (for example `{{contact.last_name}}`) and map **Collected Value** back to the same field.
* When collecting several fields in a row, turn on **Skip Moving On** and list the fields already collected in **Lookback Ignore**.
* To collect an email address, use [SMS | Get Valid Email](/tools/composite/sms-get-email). For a value that is easier to type than say, use [SMS | Get Value](/tools/sms/get-value).

***

## Next Steps

* [Data Collection - v0.2](/tools/composite/data-collection) — the general-purpose collection tool
* [Composite Tools](/tools/composite-tools) — how composite steps run and write their outputs
* [Variables](/flows/variables#data_collection) — the `data_collection` namespace
