# Default Values {#default-values}


A default value supplies an **initial answer** when a form starts. It is
evaluated **once** — when the form is opened — and does **not** change when
referenced answers are updated later. If you need a value that re-computes when
other answers change, use [Auto-Populate / Calculations](/user-manual/calculation-expressions.md)
instead.

Default values use a **different reference grammar** from calculations:

| | Default Value | Calculation |
|---|---|---|
| Reference style | `#question_name` | `${question_name}` |
| Example | `#country#res_num` | `${quantity} * ${price}` |
| Functions | not supported | supported |

This page covers the default-value grammar. See
[Auto-Populate and Calculations](/user-manual/calculation-expressions.md) for the
calculation grammar.

---


## Where to configure it {#where-to-configure-it}


1. Open your survey in the **Survey Designer**.
2. Select a question of type **text, integer, decimal, date, time, or
   datetime**.
3. In the right-hand **Properties** panel, scroll to the **Advanced** section.
4. Click **Default Value**.

The **Default Value** dialog has two tabs:

- **Value Builder** — build the value visually with four modes
  (Concatenate, Date/Time, System, Static).
- **Raw Expression** — type the expression directly.

---


## Default value sources {#default-value-sources}



### Static value {#static-value}


Type plain text or a number to use it as-is:

| Expression | Result |
|---|---|
| `42` | `42` |
| `Pre-filled text` | `Pre-filled text` |
| `N/A` | `N/A` |

Example: a country field that defaults to a fixed value:

```text
India
```


### Today's date {#todays-date}


The keyword `today` fills today's date in `yyyy-MM-dd` format
(e.g. `2026-08-14`).

```text
today
```


### Current timestamp {#current-timestamp}


The keyword `now` fills the current date and time in ISO 8601 format
(e.g. `2026-08-14T14:30:00.000Z`).

```text
now
```

`today` and `now` are **whole-string keywords** — the entire default must be
exactly `today` or `now` (case-insensitive). You cannot combine them with
other text.

For time-sensitive surveys, combine `today` with the question's **Read Only**
setting so respondents cannot change the recorded date.


### Copy another question's answer {#copy-another-questions-answer}


Reference another question by name with `#`:

| Expression | What it does | Example result |
|---|---|---|
| `#country` | Copy the answer of question `country` | `India` |
| `#fname #lname` | First name, space, last name | `John Doe` |
| `hello #country world` | Literal text mixed with a reference | `hello India world` |

In the **Concatenate** builder mode, click questions in the **Available
Questions** list to add them as references. Each reference appears as a tag you
can reorder or remove. To add a space between references, add the space as a
literal separator.

A referenced question that has not been answered yet (or appears **later** in
the form) resolves to an **empty value** at form start. The builder warns you
when a reference points to a question that appears after the current one.


### System variables {#system-variables}


These auto-fill information about the current user or device:

| Variable | What it fills |
|---|---|
| `#username` | The current user's display name |
| `#email` | The current user's email address |
| `#deviceid` | The device's unique identifier |

Example — a "Recorded by" field:

```text
#username
```

System variables are case-insensitive. If a value is unavailable (for example
in offline mode), it resolves to an empty string instead of causing an error.
They are useful for audit trails and "Recorded by" fields.


### Combine values (concatenation) {#combine-values-concatenation}


You can mix literal text and references freely. A composite household
identifier generated from State + District + Household Number:

```text
#state#district#household_num
```

producing e.g. `MH-PUNE-0012`, or with separators:

```text
#state-#district-#household_num
```

There are **no function calls** in the default-value grammar — `concat(...)`
does not work here. Use concatenation as shown, or switch to an
Auto-Populate/Calculation for function-based composition.

---


## The Raw Expression syntax guide {#the-raw-expression-syntax-guide}


| Pattern | Meaning |
|---|---|
| `#varname` | Reference another question's value |
| `#username`, `#email`, `#deviceid` | System variables |
| `today` | Today's date (`yyyy-MM-dd`), whole string only |
| `now` | Current datetime (ISO 8601), whole string only |
| any other text | Static literal, displayed as-is |

The editor validates your expression when you save. A reference that matches
neither a question name nor a system variable blocks the save with an error.

---


## Setting Default Values in XLSForm {#setting-default-values-in-xlsform}


Use the `default` column in the survey worksheet:

| type | name | label | default |
|---|---|---|---|
| `text` | `psu_id` | PSU Identifier | `#country#res_num#psu_resnum` |
| `text` | `recorded_by` | Recorded By | `#username` |
| `date` | `visit_date` | Visit Date | `today` |
| `text` | `status` | Status | `Pending` |

When you import the XLSForm, all default values are preserved and visible in
the designer's Default Value editor.


### Additional values for choice questions {#additional-values-for-choice-questions}


For `select_one` and `select_multiple` questions, the `additional_values`
column defines extra accepted values beyond the defined choices:

| type | name | label | additional_values |
|---|---|---|---|
| `select_one` | `satisfaction` | Satisfaction Level | `98, 9997, 9998` |

This is used for survey-standard codes like `98` (Don't know) or `9997`
(Refused) without modifying the original choice list. Values are deduplicated
at runtime — if a value already exists in the choice list, it is not added
again. You can manage additional values in the designer by expanding the
**Additional Values** section in the Extended Properties panel.

> `additional_values` is a separate column from `default`. It controls which
> answers are *accepted*, not what is pre-filled.

---


## Default vs Auto-Populate {#default-vs-auto-populate}


| | Default Value | Auto-Populate (calculation) |
|---|---|---|
| **When evaluated** | Once at form start | Every time dependencies change |
| **Reactive** | No — static after form start | Yes |
| **Reference syntax** | `#question_name` | `${question_name}` |
| **Functions** | No | Yes |
| **Best for** | Initial static values | Dynamic computed values |

If a field needs to update when other answers change, use
[Auto-Populate / Calculations](/user-manual/calculation-expressions.md) instead of a default
value.
