# Dynamic repeat labels - Collect v Enketo v Web forms

**URL:** <https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036>\
**Category:** Support\
**Tags:** enketo, form-design, odk-collect\
**Created:** [August 1, 2025, 7:35am UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036 "2025-08-01T07:35:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 1, 2025, 7:35am UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036/1 "2025-08-01T07:35:03Z")

</div>

I think this is going to end up a multiple post issue as I try to work through labels / repeats / indexed-repeat values and rolling up summaries... 🙃

**1. What is the issue? Please be detailed.**  
When a form results in a repeat with many findings, it is very helpful for the enumerator to see some more information in the Collect table of contents screen to be able to quickly find the one they need to return to. Seeing this is less helpful

- `Finding repeat > 1`
- `Finding repeat > 2`
- `Finding repeat > 3`
- `Finding repeat > 4`
- `Finding repeat > 5`

Compared to something like this, or whatever combination of values is needed to quickly ID the finding (name / age / medication...)

- `Finding [corrosion] [severe] > 1`
- `Finding [vibration] [moderate] > 2`
- `Finding [corrosion] [light] > 3`
- `Finding [coating] [minor] > 4`
- `Finding [coating] [severe] > 5`

So, initially, (naïvely!) I thought, no problem, just whack ${field-name} in the repeat label, job done.

Now, this works in Collect, but perhaps it shouldn't, as it doesn't work in Enketo and also doesn't work in Web Forms. However you can use ${field-name} in a label of a note/question inside a repeat in all three without having to refer to position within the repeat at all, so what makes the **label of a repeat** special compared to **labels inside a repeat**?

Then I thought, ok, we can use `instance` expressions in labels, so I'll just try an indexed-repeat expression, but this both doesn't work, _and_ gets really wonky in Enketo/WF as it started to show values from different choice lists in the broken expression somehow in another form.

I know the indexed-repeat logic is correct as I included a calculate inside the repeat with it and a note to display the result.

After that I tried to go back to an instance expression and then instance but include some position values, first with an indexed repeat and then with a selected-at (after joining the values outside the repeat to select on), all of these failed in different ways.

I'm currently out of ideas on how to further leverage xpath expressions for this (ping @LN!) , and am not sure if I've missed the solution, or if I **should** be able to use the field name directly and it's just that Enketo & WF aren't properly displaying the value (well Enketo can't as it only ever shows the repeat label once, but WF does repeat the label and doesn't even display it _at all_ in the label, but does in the add repeat button ping @JenniferQ!)

While I could leave my form with only the direct field in the repeat label and be happy it works in Collect I'm concerned that a) this may not work forever, b) I could cause issues when editing / completing via web c) Web Forms cannot display a field in the repeat label **at all** currently and then suppresses text after the field

**2. What steps can we take to reproduce this issue?**  
Try the attached basic form in Collect vs Enketo & WF

**3. What have you tried to fix the issue?**

- use the field code directly - Only ok for Collect. Enketo shows first value, but label not repeated. WF repeat label goes blank at expression and suppresses text after expression. 'add repeat dialogue' does evaluate expression and doesn't suppress, but only ever shows value for first repeat element ❌
- use indexed-repeat directly - in a label it doesn't work properly anywhere but as a calculate then displayed with a field it does ❌
- use an instance lookup directly - Only ok for Collect. ❌
- use an instance lookup with indexed repeat as the filter - doesn't work properly anywhere ❌
- use an instance lookup with selected-at as the filter (and a separate join outside the repeat) - doesn't work properly anywhere ❌
- Asked kapa.ai varying versions of how to get a value for a certain element of a repeat

**4. Upload any forms or screenshots you can share publicly below.**  
(to make it easier to keep adding new test cases for this form I created most of the field names and expressions as XL formulae, but this doesn't affect the outcome)

[dynamic repeat labels.xlsx](https://forum.getodk.org/uploads/short-url/xAEqjs6eaIjVvuDaJZ7vD6217Z1.xlsx) (586.8 KB)

---

<div class="post-metadata">

**Author:** ![JenniferQ](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jenniferq/32/29022_2.png) [@JenniferQ](https://forum.getodk.org/u/JenniferQ)\
**Post date:** [August 1, 2025, 3:27pm UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036/2 "2025-08-01T15:27:22Z")

</div>

Hi @ahblake, nice to read you in the forum!

> So, initially, (naïvely!) I thought, no problem, just whack ${field-name} in the repeat label, job done.

Almost! Answering from Web Forms POV:

The `begin-repeat` in XLSForms acts like a wrapper for all repeat instances, so it can’t directly pull data from individual instances dynamically. It’s better suited for referencing fields outside the repeat, like a global field defined earlier in the form.

To get a dynamic label that shows data from within each repeat instance (e.g., a user-entered name), you need to define the label inside the repeat itself. A clean way to do this is by adding a `begin-group` within the `begin-repeat`, like in the example below:

| type | name | label |
| --- | --- | --- |
| begin-repeat | repeat-wrap-1 | |
| begin-group | group-1 | Instance ${name} |
| text | name | Enter a name |
| end-repeat | | |
| end-group | | |

The `begin-group` inside the `begin-repeat` creates a scope where `${name}` resolves to the `name` field in the current repeat instance. So, if the user enters “Anna” in one instance, the group label shows “Instance Anna”.

The `begin-repeat` label itself is left blank because it’s not meant to be dynamic per instance. If you wanted a dynamic label for the entire repeat group, you could reference a field outside the repeat.

In the example you provided before, it would be like this:

 ![Dynamic labels](https://getodk.b-cdn.net/uploads/default/original/3X/9/3/93a4227731d5e9f555418146ad245a4b0df885e7.png)

[dynamic repeat labels - FIXED.xlsx](https://forum.getodk.org/uploads/short-url/m7q6R7HMizVMnIrxcO0h5jweNo8.xlsx) (283.5 KB)

This is how it works:

However, this is not supported for translated labels yet, we have a ticket for that here: [Allow output in translation text #22  
 ](https://github.com/getodk/web-forms/issues/22)

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 4, 2025, 3:26am UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036/3 "2025-08-04T03:26:42Z")

</div>

> [@JenniferQ](#):
>
> To get a dynamic label that shows data from within each repeat instance (e.g., a user-entered name), you need to define the label inside the repeat itself. A clean way to do this is by adding a `begin-group` within the `begin-repeat`,

This is interesting and thanks for the explanation - I actually have a group in my repeat to allow `field-list` appearance, but stripped it out to show the issue more simply. Up to now I had focussed on inserting my value into the repeat label as I assumed (🙃 ) that's what the user sees in the Collect ToC view - **I didn't yet try leaving the repeat blank or static / also or only labelling the group and seeing if the group appeared in the ToC**

So - new tests! With some interesting outcomes, hope this is useful for others and training kava 😉

> Using versions:  
> 3bb4a6d16bd587530965479ca63b140bb473bd77 (v2025.2.1)  
> c026a7ad6411c0fdabac86ffb2cb3c3d89ee11d2 client (v2025.2.1)  
> 7ea7964302e981572fb346760db0ed9d522bb4bb server (v2025.2.1)  
> Collect 2025.3.0 Beta 2

[better-dynamic repeat labels.xlsx](https://forum.getodk.org/uploads/short-url/8P1NmyA1duXEEAWjAkmNN5flMgT.xlsx) (596.5 KB)

- In general -
  - only need to use the field code in the group label, no xpath magick required ✅

  - Web Forms cannot

  - To get the behaviour I want the approach seems to be:

  - FYI **Not every time, but most times** when drilling **up** in Collect ToC view starting from inside the group, when shown the list of [repeat#]. [group label], it takes **two** ⬆ taps to get to the next level up, and occasionally, **three**. If you jump repeatedly between the list of elements and the group content, occasionally it also takes two ⬆ taps to get back to the list of groups. The taps are registered as the icon flashes with no nav change. Jumping between repeat and group without entering a group usually only requires one tap to drill back up but occasionally two.

* * *

- 
## A. Blank repeat label, dynamic group label, no repeat content outside group

  - Central - will warn about the blank repeat label but is allowed
  - Collect
    - From highest level ToC view, one tap into repeat, then the repeat # is shown followed by the **group** label, one tap to select the repeat/group element, one tap to select a question and the form is presented _(3x taps from top level to being able to answer a question)_
    - Under form title you see `[group label]` in small grey text, no repeat element #
    - Adding a repeat shows 'Add another?' dialogue

  - Enketo
    - The repeat label is blank
    - Group label is displayed inside repeat (blue bg) but in larger font, like the repeat label would be
    - Cannot collapse the entire repeat as no ▶ icon at the repeat level, can only collapse each group individually
    - Add repeat is only "➕", not possible to show text here so no impact of a blank repeat label
    - Each element gets it's own group label with the different dynamic text.

  - Webforms
    - the group label value **is displayed larger with grey background** , how repeat label is usually styled
    - the 'Add' repeat element button only says 'Add'
    - Collapse at grey header only

- 
## B. Static repeat label, dynamic group label, no repeat content outside group

  - Central - no warnings
  - Collect
    - From highest level ToC view, one tap into repeat, then the repeat # is shown followed by the **group** label, one tap to select the repeat/group element, one tap to select a question and the form is presented _(3x taps from top level to being able to answer a question)_
    - Under the form title you see `[repeat label] > [element#} > [group label]`
    - Adding a repeat shows 'Add "[repeat label]"?' dialogue

  - Enketo
    - The repeat label is shown outside the blue bg region
    - Group label is shown inside the blue bg region and prepended with `»`
    - Can collapse the entire repeat
    - Each element gets it's own group label with the different dynamic text.

  - Webforms
    - the group label value **is displayed larger with grey background** , how repeat label is usually styled, in line with the repeat element #
    - the 'Add' repeat element button says 'Add [repeat label]'
    - Collapse at grey header only

- 
## C. Static repeat label, dynamic group label, _plus user interface repeat content outside group_

  - Central - no warnings
  - Collect
    - From highest level ToC view, one tap into repeat, then the repeat label & # is shown, tap to select, group and non group shown, tap to select, group content shown, tap to enter form. _( **4x** taps from top level to being able to answer a question as you have to select the repeat **and** the group)_
    - Under the form title you see `[repeat label] > [element#} > [group label]`
    - Adding a repeat shows 'Add "[repeat label]"?' dialogue

  - Enketo
    - Same as when no content outside group.
    - There is no clear indication where the group ends (group content is not indented / no hairline at end of group or box around group plus label), but collapsing the group only leaves the content outside the group shown.

  - Webforms
    - **different** to when no content outside group
    - The repeat label is displayed with the grey background in line with repeat element #, the group label is displayed inside the repeat box
    - There is no clear indication where the group ends (group content is not indented / no hairline at end of group or box around group plus label), but collapsing the group only leaves the content outside the group shown.
    - the 'Add' repeat element button says 'Add [repeat label]'
    - Collapse at grey header **and at group label**

- 
## D. Static repeat label, dynamic group label, plus hidden (calculate) repeat content outside group
- Central - no warnings
- Collect
  - ToC nav behaves as for **B** - 3x taps from top level to form, only # Group selected, not Repeat # & Group.
  - repeat/group label behaves as for **C** - shows repeat \> # \> label

- Enketo
  - As for B

- Webforms
  - Behaves as for C

- 
## E. Dynamic repeat label, dynamic group label, no repeat content outside group

  - Central - no warnings
  - Collect
    - ToC nav as for B, 3x taps from top level to form, only # Group selected, not Repeat # & Group.
    - repeat/group label behaves as for **C** - shows repeat \> # \> label
    - Only element #1 value shown for repeat label at top level but small grey label in form is correct for each element

  - Enketo
    - As for B, but the single repeat label only shows the value from element #1

  - Webforms
    - As for B, but the 'add repeat' label only shows the value from element #1

---

<div class="post-metadata">

**Author:** ![JenniferQ](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jenniferq/32/29022_2.png) [@JenniferQ](https://forum.getodk.org/u/JenniferQ)\
**Post date:** [August 5, 2025, 4:48pm UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036/4 "2025-08-05T16:48:11Z")

</div>

@ahblake thanks for posting these findings! Are any of these differences a blocker or barrier to the workflow you're building?

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 6, 2025, 12:25am UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036/5 "2025-08-06T00:25:35Z")

</div>

No blockers, I documented it for webforms development and other users reference. As I use a lot of functionality that's not present in WF yet I am not using it currently.

Thanks to your explanation and my subsequent testing of the various permutations, I've found the best way to dynamically label repeat elements that works in Collect vs what 'worked' but was technically wrong and would probably stop working in a future update.

The minor 'issues' in WF I would consider to be

- putting a field from outside the repeat in the repeat label isn't shown and suppresses following text in label (but the add repeat button shows correctly)
- can't collapse an entire repeat (actually a user need or just a difference from Enketo?)
- end of a group in a repeat (in general?) is not clearly defined (actually a need, as Enketo is the same?)

The multiple taps in the ToC nav in Collect is only a small annoyance

---

<div class="post-metadata">

**Author:** ![Aly\_Blenkin](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/aly_blenkin/32/19303_2.png) [@Aly\_Blenkin](https://forum.getodk.org/u/Aly_Blenkin)\
**Post date:** [August 7, 2025, 7:03pm UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036/6 "2025-08-07T19:03:53Z")

</div>

Thanks so much for the detailed feedback, Andrew!

From a design perspective, we’re always trying to strike the right balance between providing enough clarity, giving the user confidence, and making the experience consistent across tools. Sometimes this means that interactions behave differently intentionally across platforms, especially when that improves clarity in context. Other times, inconsistencies are unintentional 🙃! Sharing your experience and pointing them out is very helpful!

In general, our goal with the repeat redesign was to make groups, repeats, and nested sections easier to navigate, especially as earlier versions of Web Forms relied heavily on parallel lines and indentation, which became visually overwhelming. We also incorporated feedback and lessons from Enketo’s approach. While we assume most use cases involve nesting no deeper than 2–3 levels, we recognize that deep nesting for more complex forms can still be challenging. If the current design feels too minimal or hard to follow, we’re definitely open to ideas for improving structure without adding too much visual clutter.

**Repeat labels not showing fields from outside the repeat**  
Referencing values outside the repeat is great feedback. We will add this chat about this more as a team.

**Collapsing entire repeat groups**  
Collapsing entire repeat sections wasn’t something I initially designed for because we assumed collapsing the individual repeats would be enough for 3 levels deep. However, if others also find this challenging as well, we can definitely revisit the idea of making repeat sections collapsible, especially as more complex forms are built in Web Forms.

**Stronger signalling for end of repeat group**  
Your note about the end of group signalling is also helpful. Currently, we rely on the end of the container to signal this, but I agree this can be subtle, especially with deep nesting. There may be ways to enhance that visual cue further.

**Table of Contents (ToC)/ summary view interaction in Collect**  
I hear you on it being annoying to have so many taps, we will note this to think about ways to improve that experience!

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 7, 2025, 11:57pm UTC](https://forum.getodk.org/t/dynamic-repeat-labels-collect-v-enketo-v-web-forms/56036/7 "2025-08-07T23:57:18Z")

</div>

> [@Aly\_Blenkin](#):
>
> so many taps

Just in case I wasn't clear - it's the taps on the ⬆ that sometimes don't result in a nav action, only an ack that there was a tap (button flash), I was highlighting here. It's repeatable, but not perfectly consistent.
