# Merge items from two multiple select questions into one variable

**URL:** <https://forum.getodk.org/t/merge-items-from-two-multiple-select-questions-into-one-variable/26538>\
**Category:** Support\
**Tags:** form-design, odk-xlsform, odk-collect\
**Created:** [May 17, 2020, 8:40pm UTC](https://forum.getodk.org/t/merge-items-from-two-multiple-select-questions-into-one-variable/26538 "2020-05-17T20:40:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hannington\_Odido](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/hannington_odido/32/11387_2.png) [@Hannington\_Odido](https://forum.getodk.org/u/Hannington_Odido)\
**Post date:** [May 17, 2020, 8:40pm UTC](https://forum.getodk.org/t/merge-items-from-two-multiple-select-questions-into-one-variable/26538/1 "2020-05-17T20:40:26Z")

</div>

I have two select\_multiple questions authored on odk-xlsform that I need to join the selected answers into one variable. Example questions (1) and (2), are:  
(1) Select all the fruits you ate today?  
(a) Mango  
(b) Orange  
(c) Apple

(2) Select all the starch you ate today?  
(a) Bread  
(b) Pasta  
(c ) Potatoes  
(d) Rice

Question (1) a and b are selected  
Question (2) b, c and d are selected

I need to join the answers from question 1 and those from question 2, to have a variable (all\_food\_eaten) with all the 5 answers (1a, 1b, 2b, 2c, and 2d).  
I would like to use the variable (all\_food\_eaten) to form the basis for a repeat that repeats a count-selected number of times (in this case, 5 times). Each repeat has a set of questions for the five choices.

I will highly appreciate your assistance.

Thank you.

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [May 18, 2020, 2:06am UTC](https://forum.getodk.org/t/merge-items-from-two-multiple-select-questions-into-one-variable/26538/2 "2020-05-18T02:06:10Z")

</div>

select\_multiple results are stored as a space-separated string; eg "`mango apple`". So if you want to combine two of them you can just [concat()](https://docs.getodk.org/form-operators-functions/#concat) the two results together - separated by a space - to effectively create a new select-multiple answer. Try this:

`all_food_eaten: calculation = concat(${fruits}, ' ', ${starch})`

You can then use `${all_food_eaten}` just like a regular select\_multiple result.
