How do i display the responses (in a note) that i made for a multiple response question?

Hello, I have a multiple choice question, and I want the selected label option to show in a note question, there’s no problem if I have only one answer but If I have 2 it doesn’t show anymore, what can I do? I need to show the answers at the end.

the xls form

the form

Hello,
just quick reply, sorry.
You may use selected-at(,) with jr:choice-label and concat … to get them all together.
See https://docs.opendatakit.org/form-operators-functions/?highlight=selected#selected-at
and
https://docs.opendatakit.org/form-operators-functions/?highlight=concat#concat
Kind regards

1 Like

Hi @analucia_espinoza,

Just backing up with and example on what @wroos has suggested earlier.

In the survey tab of the xlsform:

In the choices tab of the xlsform:
Image 2

Output seen in Enekto:

Reference xlsform:
Display Response for Multiple Choice.xlsx (42.4 KB)

HAVE a GREAT DAY!

2 Likes

Hello,
first note could be simply:
note note1 Selected fruits: ${Q1}.
(The selected names (not labels) in a multiple_select variable are stored as textstring, separated by blanks.)
Kind regards

2 Likes

Thank you very much!! It’s working perfectly, Now I try to use join to separate each selection with a comma, but it only works for repeating groups. I don’t want to have a lot of commas showing in my note… If a person only selects two people then I want only one comma, if they select three people, then I want two…

This is what I don’t want…

Is there a way I can get only the commas that I need according to the number of names selected?

@analucia_espinoza
What you are looking for is more like putting constraint on the number of commas that should be presented based on the number of names. Unfortunately this is not something that can be done using a straight forward approach as pulling the name. My suggestion would be you use a different separator such as a space between the names. The space would not be visible since it is not a visible character.

Stephane

Dear @stephanealoo,
putting space (or new line) directly between the ${) $() into the note seems NOT to work (at least not in Enketo/View), as KoBo removes them here in the note. You can see it, when you view the xls. sent by @Kal_Lam. What is strange here, maybe a bug even?

The blank could be added in each calculate for the labels (by concatenate).
Or in an additional calculate variable for the whole string. In note label unfortunately function are not possible, as far as I now.

So, what is generally a good solution to separate/format longer not output with ${…}s? E.g. to list them one per line.
Kind regards

1 Like

Hello! How can I list them one per line? I tried to use
, but it shows in the form :frowning:

Dear @analucia_espinoza,
I tried to find some solutions. See attached xls. Display Response for Multiple Choice 02.xlsx (53.0 KB) . Beside the note, there is also an option with a select and text field (both read_only). The multiline text option might not work in KoBoCollect.

What seems to work equally for KoBoCollect and Enketo is the option with the (read_only) select list as output

There might be an important difference between the behavior on blanks and newlines between KoBoCollect and Enketo (web), also active in VIEW mode.
So, it might even work very simple with putting blanks or newlines (Ctrl-Enter) in the note label on mobile device. I would be interested to know what works in KoBoCollect.

In Enketo/View-mode the system internally seems changing/reducing blanks and newlines and the formatting, as you can see with the xls.

I think, there might be an easier solution to force a user-defined formatting in a note (or other text). Maybe @Kal_Lam or @stephanealoo could suggest one.

There is also a general hints in the community about newlines, see





Maybe @Tino_Kreutzer could give an UPDATE on this.

Side-note: It’s often frustrating that - because of differences of Enketo - the View mode cannot fully be used for testing of KoBoCollect forms.

Kind regards
Wolfgang

1 Like