# Generate multiple choice alternatives, based on the answers in a repeat

**URL:** <https://forum.getodk.org/t/generate-multiple-choice-alternatives-based-on-the-answers-in-a-repeat/10269>\
**Category:** Support\
**Tags:** form-design, odk-xforms, odk-xlsform\
**Created:** [October 18, 2017, 2:54pm UTC](https://forum.getodk.org/t/generate-multiple-choice-alternatives-based-on-the-answers-in-a-repeat/10269 "2017-10-18T14:54:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [October 18, 2017, 11:04pm UTC](https://forum.getodk.org/t/generate-multiple-choice-alternatives-based-on-the-answers-in-a-repeat/10269/4 "2017-10-18T23:04:24Z")

</div>

Very interesting question!

This is possible but as far as I know you will need to write the dynamic `select one` in raw XML. What I would do is create my form in XLSForm leaving that question aside, convert the form to XML and then modify the `select one`.

The general idea is to use an `itemset` that refers to your `repeat` in the `select1`. To build my example, I started with the XLSForm [here](https://docs.google.com/spreadsheets/d/1jHLccGYNdbS-ScnfyFSdNmlnRBhtgsUc-qzjEXK8Ids/edit#gid=0). Then I replaced the definition of the `select1` with:

```auto
<select1 ref="/select-one-from-repeats/people_select_one">
  <label>Select the relevant people:</label>
    <itemset nodeset="/select-one-from-repeats/people">
      <value ref="person_name"/>
      <label ref="person_name"/>
  </itemset>
</select1>

```

The full, functioning form: [select-one-from-repeats.xml](https://getodk.b-cdn.net/uploads/default/original/2X/8/8e949f8de5f925a8d45a1854a39db979c29966b7.xml) (1.8 KB)

Notice that both the `value` and the `label` use the name entered by the user. Depending on what analysis you intend to do on the resulting data, you could also consider using a calculate that gets the position in the repeat and use that as the value.

---

_[View the full topic](https://forum.getodk.org/t/generate-multiple-choice-alternatives-based-on-the-answers-in-a-repeat/10269)._
