Create a select-one question from a select-multiple question

Hello community,

I need to create a select-one question from the selected options in a select-multiple question. It’s possible? and how would it be?. I’ve searched the forum, but haven’t found a solution.

Thank you for your help and guidance.

1 Like

Could you check out this post/thread - is this what you’re trying to do?

1 Like

Thank you janna,

But it doesn’t work for me the way I need, I attach an image of what I get… and I also include the xlsform.
img_01
img_02
EstrategiaHS_nov 02 2022.xlsx (18.3 KB)

The selec-one should show only the option selected in the select-multiple, but all the options are displayed.

Hi @Sebas-Celade,

I’m not sure why yours isn’t working.

I modified your XLSForm slightly as there were a couple errors in it:
EstrategiaHS_nov 02 2022.xlsx (19.1 KB)

  1. I updated the ‘name’ of the ‘op’ choice-list options in the choices tab.
  2. there was an error in the calculation for ${cal_05} which I fixed.

Here’s the video of it working as I think you want it to:
Animated thumbnail for videoWatch Video

The one odd thing you get is column-name references in the final ‘data table’ instead of the actual values, but I’m not sure if that’s what you want or not.

Let me know if this fixes the issue?
Janna

1 Like

Hi Janna,

Thank you very much for what you were able to do and yes you are right, what I would expect and need to get in the data table, are the actual values and not the references… the problem is that I don’t know what changes to make, so if can you still help me would be fantastic.

Thank you

Here is another option:
https://docs.getodk.org/form-logic/#generating-select-ones-from-repeats

Side-note: It preferable to always use the Online validator during form development: Open Data Kit - XLSForm Online. Even multiple times.

2 Likes

Ooooh, @wroos, I did not know about that! Going to try that pronto! Thanks for the link!

@Sebas-Celade, will support with that one extra step, yes, will revert.

Thanks,
Janna

1 Like

Dear Jana,
here is an example select-one-from-repeats - Google Sheets

See also in the forum, since 2011 supported

(and Having issues with select-one-from-repeats - #11 by Kal_Lam - also KoBo Preview is working meanwhile).

A small disadvantage is that you will not get name / labels for export, e.g. for SPSS, as with normal choice lists. (But you will also not get the final dynamic labels out with your solution.)

The select from repeat only works for select_one, not for select_multiple. (See Online validator error). But it seems to work with rank type even!

Kind regards

2 Likes

Hello @Sebas-Celade
Here is how it should work, simplified
select_from_repeat02.xlsx (10.1 KB)
I also added a title (name) for the repeat group, following the warning of the Online validator

2 Likes

Dear community,

Thank you for your responses and suggestions, but I must share that I still cannot solve what I need to do to implement this online survey (Enketo). Janna managed to solve the requirement to build a select-one from a select-multiple that is created from repeating text (see video and xlsform, modified by janna, above). The problem now is that when reviewing the answers in the “data / table” option, references to the selected options appear, and what she would expect to see are the actual values. Attached screenshot of what appears:

Until now I have searched and tried different alternatives but I do not get my task.

Thank you for the help you can continue to offer me.

Hi @Sebas-Celade,
Please see the solution provided by @wroos in this reply further up, as it solved this problem you’re referring to, with having the dynamic labels instead of the actual selected options in the final data table…

Does this work for you?
Janna

Dear community members, janna, greetings from Chile.

Thank you for the time you have taken to help me with this task, but although we have made progress in solving what I need, there is still work to be done.

First I share screenshots of the report that I get from the online validator: In the first image the select-one (row 20) is linked to the select-multiple (row 16) that results from the repeat group and works well for the form. The problem is that the actual values ​​do not appear when reviewing the form that has been answered, as shown in the image in my last post. The validation of this form gives me:

OnLineValidator_with_select_one op_in_row20
The second image shows the validator report when I have modified the select-one leaving it as “select_one ${F2_01}” but even if it worked, this is not the strategy that is needed
OnLineValidator_with_select_one ${F2_01}_in_row20
This is the xlsForm I am working on
UpDateOK_EstrategiaHS_nov 02 2022.xlsx (12.5 KB)

(The following tries to provide the context of what I need to achieve and I apologize for how long it may be)

Second, let me share that this xlsForm is a prototype for a section of the actual form I’m working on. The definitive survey will be made up of two forms linked to each other, one of them (the main one) will be answered by a focal point who will be in charge of informing a series of actions (there may be more than one hundred) in which he will inform the name of each action and the body that is in charge of carrying it out (for example there are five actions whose responsibility is body A, another 12 are in charge of body B and so on, this is what will be collected in the repeat group). The multiple Select of row 16 fulfills the function of ordering in a list the actions that have been reported and facilitating the task of the focal point to send to each agency the actions for which it must provide detailed information as a target population, since when it comes implementing etc

Once all the actions to be informed have been entered, the focal point will select from the multiple-selection the actions that will be sent to agency A and those that will be sent to agency B, and so on for all actions)

Organizations A, B and all the informants will receive a child form that, among other types of questions, will have the select one with the list of actions for which they must complete a detailed sheet for each of them.

Because of this structure, the solution provided by Janna (see video above) is what is needed… but the problem that the real values ​​of the selected options appear in the data table and not the references to they.

Thanks again for all the help you have given me.

Perhaps, it might be easier to do the first step with Excel. And then create a csv file and use it to import the choice list(s) for the next form.

Hint: This short form from above did not show any issues with validator and preview. Create a select-one question from a select-multiple question - #10 by wroos

1 Like

Hi @Sebas-Celade ,
Okay, I’ve done another iteration for you.

You were on the same track that I was, using the jr:choice-name construct to basically bring in the label, which we can use the calculation to essentially turn back into the ‘original’ action entered.

Take a look at the XLSForm here:
UpDateOK_EstrategiaHS_nov 02 2022.xlsx (13.0 KB)

Please note:

  1. We still have the original data columns where the ‘reference’ shows up, e.g., ‘${cal_o1}’
  2. We then make a series of calculated columns that turn '${cal_01} back into the original word, e.g., jelly, cupcake, etc.
  3. I’ve then made a column that ‘concatenates’ all the selected values into a single column, in case that’s helpful = not sure how you’re analysing/using the data once it’s collected - so delete as needed.
  4. you’ll see I’ve put in a ‘note’ question that just shows me what the form is calculating as I enter values - you can delete this, but it’s helpful for testing.
  5. And I’ve done the same calculated value for one last column after the ‘select_one’ question.

Here’s the video of how it works:
Animated thumbnail for video
Watch Video

Hope this is closer to what you’re looking for.
Janna

PS. I’m not sure if you’re calling two related forms parent and child because you want to make them ‘connected’ projects in KoBoToolbox. But just to note, that you can’t pull in selected responses from one form to create a choice-list in a child form in the ‘connected projects’ constructed with KoBoToolbox. So I would recommend to just think through the workflow you’re planning, and make sure the technical functionality will support it. As @wroos suggested above, you might need to have an element of manual intervention between the two forms and use Excel or Google Sheets, etc, to organise data in between form A/form B submissions. But not entirely sure your workflow, so hope you’re able to get one step closer!

3 Likes

Hi janna,

Thank you for your help and because you have undoubtedly helped me get closer to what I wanted to achieve. I know that I still have a lot of work to do to solve the issue of linking two forms, but I am encouraged to know that I have the help of the community and yours in particular.

Thank you

2 Likes

@janna, :clap: :heart: :partying_face:

1 Like