Understanding Multiple-Choice Questions in Survey123 for ArcGIS

49908
47
08-29-2017 10:34 PM
IsmaelChivite
Esri Notable Contributor
15 47 49.9K

Through a multiple-choice question, users are allowed to select one or more

options from a predefined list of values.

Some scenarios where multiple-choice questions are handy include:

  • In an asset inspection form, a multiple choice-question can be used to represent a checklist.
  • In a water-waste report, a multiple-choice could represent the potential violations of the city's code.
  • In a household needs assessment survey, a multiple-choice question can be used to indicate if one or more of the following are needed: water, clothes, food, blankets.

This blog post covers multiple-choice questions in depth, starting with the basics but also covering some advanced techniques.

The Basics: How to create multiple choice questions

Multiple choice questions can be created both from Survey123's Web Designer as well as  from Survey123 Connect for ArcGIS. 

Survey123 Web Designer:

Survey123 Web Designer is available at https://survey123.arcgis.com  Log with your ArcGIS Online credentials and choose New Survey. You will be prompted to launch Survey123 Web Designer at that time.
                

Configuring multiple choice questions from Web Designer is an absolute no-brainer: you can easily drag a Multiple Choice question into your draft view of the survey and start adding choices immediately.  This video will show you how to get started:

Right from Web Designer, you can use the Validation section to control the minimum and maximum number of options that can be checked in the question by the end-user.

Survey123 Connect for ArcGIS:

With Survey123 Connect for ArcGIS you can define multiple-choice questions using the XLSForm specification.  Using Survey123 Connect is more  involved, but gives a good deal of flexibility defining the look and feel of your multiple-choice questions as well as user-input  validation rules.

XLSForms is a standard that describes how to define smart forms using an XLS spreadsheet.  I recommend using Microsoft Excel when creating XLSForms for Survey123 for ArcGIS.

Survey123 Connect is a desktop tool that you can download to help you create and publish your XLSForms into ArcGIS.

You can download Survey123 Connect from our Survey123 download page.
                

In XLSForms, multiple-choice questions are modeled as select_multiple type of questions.  To properly create such a question you must define a list defining all choices to be shown, and you must create the list in the choices worksheet of your XLSForm.  This 3 minute video-tutorial introduces choice questions in XLSForms. It touches on questions that let you select one choice (select_one) and those where you can select multiple choices (select_multiple).

Advanced Topics: Multiple-Choice Questions and XLSForms

Beyond adding basic multiple-choice questions to your surveys, there is much, much more you can do. In the next few sections I will explore in more detail some advanced techniques and concepts regarding multiple-choice questions and XLSForms.

Appearances

By default, elements in your multiple-choice questions will be arranged vertically in a single column. You can however arrange your choice lists differently using the appearance column in the survey worksheet of your XLSForm:

  • Leaving the appearance column empty will arrange your choices vertically in a single column. This is typically the best option when you want to include a small number of choices. Say up to 10 or so.  Using a single column also makes handling long labels easy. 
  • Setting the appearance value to horizontal may allow you to save vertical real estate when displaying all choices at once. In practice, the horizontal appearance is best when you have a very small number of choices and when the choice labels are short. The horizontal appearance will attempt to display all choices in a single row, but if the width of your device is not enough, it will start arranging elements in columns.

The best thing about the default and horizontal appearances is the fact that all choices are presented at once to the user, minimizing clicking and tapping. Having all choices visible at all times accelerates data entry, and is also handy when you want to review responses in a survey.   Now: displaying all choices at once it not the best idea when you have many choices.

  • The minimal appearance will collapse your choice list into a drop-down menu.  This is advantageous when the list of choices is long because  it reduces the vertical real estate needed to render the form. It can also help reducing the initial loading time of the survey. The caveat is that for user to check choices in the list a tap is needed before one can see the options.

No other appearances apply to multiple choice questions. If you use other appearances (numbers, autocomplete, etc) the arrangement of choices  will be shown as horizontal.

Label Formatting

You can refine the look and feel of your choices using HTML formatting. This is not unique to select_multiple questions, as it also applies to select_one questions, but I thought I would add this as a reminder.  In the Residential Septic Tank Inspection survey on the side, for example, I used HTML Label formatting to underline specific  parts of the choices. HTML formatting can similarly be used to change the color of the text.  You can find a complete reference of all the HTML tags you can use in this help topic.

Just for completeness, here is what the choice list in XLSForm would look like. Note that I inserted the <u></u> HTML tag in the label of some of the choices to underline certain words.

Building XLSForm expressions for constraints, calculations, relevant statements...

There are  two critical functions in XLSForms that you need to understand before you can write effective expressions on top of select_multiple questions.

  • selected:  The selected function will help you determine if a particular choice in your list has been selected. For example, the expression selected(${violations},'overwatering') will return true if the overwatering choice has been selected in the violations question. It does not matter if overwatering is the only or one of many other violations selected... if the overwatering choice was checked, the function will return true.

It is important to keep in mind that internally, the selected choices by the user are kept as a comma separated list of values.  It is for this reason that an expression like ${violations}='overwatering' does not return true if the user has selected overwatering plus other violations.  It will only return true if the only choice selected is overwatering.

  • count-selected: The count-selected function returns the number of selected choices in a select_mulitple question.  For example count-selected(${violations}) returns 3 if the user has selected a total of 3 violations from your choice list.

The two functions above are specifically designed to work with select_multiple questions.  You can use them in different scenarios. For example, you can use count-selected in the constraint field to ensure that no more than 4 choices are selected in a particular multiple-choice question.  You can also use selected to control the visibility of a note through an expression in the relevant column that determines if a particular combination of choices has been selected.

Controlling how user selections are stored in ArcGIS

In the previous section I already hinted that user selections in select_multiple questions are internally handled as a comma separated list of values. Now, this does not necessarily mean that you have to store it that way in ArcGIS. There are good reasons why you may want to store them differently and this is perfectly possible.

In some cases for example, you may want to store the user selection using one field for each of the choices in your list, and a binary value indicating it the choice was checked or not.  Why you would want to do this? Well, because once you normalize your data this way you can more easily run queries and analysis on the captured data.

In the next XLSForm spreadsheet you can look at the syntax a bit closer. Note that I added as many hidden questions in my survey as choices are present in the violations list. I keep the questions as type hidden because I do not want them to be presented to the end-user, but I want their values to be stored in my feature service.  The values in these questions are automatically set through an expression in the calculation column.  If the choice is selected, I store a value of 1, otherwise, I store a value of zero.

typenamelabelcalculation
select_multiple violationsviolationsViolations observed
hiddenoverwatering_violationOverwateringif(selected(${violations},'10'),1,0)
hiddenbrokenpipe_violationBroken Pipeif(selected(${violations},'20'),1,0)
hiddentime_violationTimeif(selected(${violations},'30'),1,0)
hiddenday_violationDayif(selected(${violations},'40'),1,0)
hiddenwaterfeature_violationWater Featureif(selected(${violations},'50'),1,0)

When using this technique, keep in mind that hidden questions will by default be mirrored  in your feature service with a field of type string.  If you want to be more specific, you can force the field data type by using the bind::esri:fieldType column of your XLSForm.  For example, in my example above, I will want to set the value of bind::esri:fieldType to esriFieldTypeInteger, because I only plan to store zeroes and ones.

When working with if statements, remember that there should be no spaces between if and the open parenthesis.
  • if(selected{$question},'choice'),true,false) works
  • if (selected{$question},'choice'),true,false) will not do anything

In the case of the select_multiple question, the default field data type will be string as well, and you really do not want to change that because comma separated lists of values can only be persisted in a string field. Now, as we will see later, there are some cases where you may need to change the length of the field.

Starting with version 2.4 of Survey123 (scheduled to be released before the end of September 2017), we will introduce a new option in the bind:esri:fieldType list. This new option is null and can be used to indicate that you do not desire to persist the selection values (the comma separated list) from the select_multiple question. Using the null field type makes sense when you have used the user selections to drive values in other questions of the survey.
      

Common mistakes, errors and other tips.

Multiple-choice questions are tricky because of the way the user selection is handled. This can cause some common errors, so I will try to summarize them here.

${question}='choice' vs selected(${question},'choice'). The most common mistake  people make when working with select_multiple questions is  the belief that you can tell if a particular choice has been selected simply by simply doing a string comparison against the data in the question.  I described this above when taking about the use of the selected function, but I will be more explicit here.

Do not use ${question}='choice' to validate if a choice has  been selected. It will not work unless the  specified choice is the only choice selected in your question. You should  use the selected (${question},'choice') function instead.
            

Error Code 1000: String or binary data would be truncated. This error message is triggered when the Survey123 app is attempting to insert data into a feature service field that exceeds the capacity of that field. There are some conditions when using select_multiple questions where this error could be generated.

By default, Survey123 will create a field of type string and with length of 255 characters for every select_multiple question you add into your survey. Now, given that the result of a selection is persisted as a comma separated list of values, it is technically possible to have Survey123 attempt to add longer strings into that field. This of course can only happen when you select many choices.  If concatenating the values of all selected choices exceeds the length of the field you will get the error described above.

There are a couple of things that you could do in this extreme case. The first one is to make the field for your question bigger by using the bind::esri:fieldLength column in you the survey spreadsheet of your XLSForm.  The second one, is to rethink the length of the names given to your choices in the choices spreadsheet.   As indicated above, starting with 2.4 you can even decide not to store the comma separated list of values which certainly will get rid of your error...

Pointing your select_multiple question against an integer field. Imagine that your select_multiple question is using a choice list where the values (names) are all integers. Well, then you should be able to store the user selection in an integer field. Right? No!  Remember that if the user selects more than one choice, the output of the select_multiple is a comma separated list of values... That will be a string.

Defaults. Just like with any other type of question in Survey123, you can define in your XLSForm what the default values should be.  Given that select_multiple data is modeled as a comma separated list of values, you can make one or more choices be selected by default by simply figuring out what the comma separated string should look like. To get  things straight, make sure that the order of choices in your string is the same as the order of values in your list.

Multiple-choices & Multiple-Languages. Also like any other question n Survey123, you can translate select_multiple questions into multiple languages.  For details, have a look at this other blog post on Introducing Multiple Language Surveys.

All in one sample.

It has a lot of merit if you got so far down into this post. There are quite a bit of boring details up there!  In case you like learning by example, we have a added a new XLSForm sample into Survey123 Connect that illustrates much of what is described here.  You will learn quite a bit by simply looking at the XLSForm.  To open the sample, go into Survey123 Connect, click on New Survey and select the Multiple-Choice survey from the Samples category.

If you can't choose wisely, choose many times.

(Old Kiwi proverb...Chinese, Italian... OK, I just made it up )

Tags (3)
47 Comments
BrentKinal1
Occasional Contributor III

I am excited to see the bind:esri:fieldType = NULL in the next release. Just curious...will this just clear values from the field? or will this prevent the whole field from being part of the feature layer? I would love the ability to have questions in a form primarily for navigation within the form but not store the results in the feature.

IsmaelChivite
Esri Notable Contributor

Not to give away too much from 2.4   but the null esriFieldType will indicate to Survey123 that no data from that particular question should be stored in the feature service.  The purpose of this esriFieldType flag is as you indicate to let you add questions into your form that  may help with navigation or to capture data from user that you will later process/modify before storing it into the feature service.

 As usual, if you want to play with upcoming features you are welcomed to test the daily builds from our Survey123 Early Adopter Program.

BrentKinal1
Occasional Contributor III

AWESOME!!! You guys have read my mind. Keep up the great work.

MarkBennett
Occasional Contributor

@Ismael Chivite

Great Article, it helps a lot for a beginner!

Two followup question regarding put the condition in the "relevant" field to where the text field should show:

1. How to do "if a checkbox is not selected, then show"?

2. How to do "if checkbox1 and/or checkbox2 is selected, then show"?

Thanks,

Ming

IsmaelChivite
Esri Notable Contributor

Hi!

 for #1: In relevant column insert:   not(selected(${MultipleChoiceQuestion},'ChoiceThatShouldNotBeChecked'))

 for #2: selected(${QuestionName},'Choice1') and selected(${QuestionName},'Choice1')

More here: The art of hiding | GeoNet 

MarkBennett
Occasional Contributor

Thanks a lot !

Ming

Sent from my Sprint Samsung Galaxy® Note 4.

SueJohnston
New Contributor III

Great article!  I'm unable to find the sample that you speak of at the end however.  I'm trying to use the hidden fields to return yes or no and i can't seem to get it to work.  I rather get nothing or all no's.  i was hoping to look at the sample to see if i could figure it out.  Thanks!

AlexP_
by
Occasional Contributor III

Hello,

I can't find  Multiple-Choice survey from the Samples category. Please advise. Thanks

IsmaelChivite
Esri Notable Contributor

Hi Alex.  I just added the sample. Hope you like it.

AlexP_
by
Occasional Contributor III

Hello Ismael Chivite

I found it and I like this! However, I realized select_multiple doesn't support autocomplete. It would be easier when it has a long list and type a shortcut for select_multiple. Please advise. Thanks!

PaulCone2
Occasional Contributor III

Hi Ismael,

Now I'm confused.  In the original article you said

 

"When using this technique, keep in mind that hidden questions will by default be mirrored  in your feature service with a field of type string.  If you want to be more specific, you can force the field data type by using the bind::esri:fieldType column of your XLSForm.  For example, in my example above, I will want to set the value of bind::esri:fieldType to esriFieldTypeInteger, because I only plan to store zeroes and ones."

Since I am pushing surveys into an existing service (related table hanging off of polygons) I created the individual fields in the table and set them to long integer and then put esriFieldTypeInteger in the bind::esrifieldType column, and then I have an if(selected(${multiplechoicefieldname},'choice')1,0) statement.  But that doesn't work -- when I query the service the fields are empty.

Now in this latest example, you just use selected(${multiplechoicefieldname},'choice') statement, and nothing in the bind::esri:fieldType column, but that doesn't work, either.  Fields are still empty.

Can you provide an example that includes what an fgdb to store the yes/no from multiple choice questions should look like?

Paul

IsmaelChivite
Esri Notable Contributor

Please send  me your XLSFile so I can have a closer look to what you are trying to achieve.  You can either post here or send  directly to ichivite at esri.com

IsmaelChivite
Esri Notable Contributor

Thanks Paul for sharing your FGDB and XLS file.

The reason why your expressions did not work is because you had a space in between if and the opening parenthesis.

  • if(selected{$question},'choice'),true,false) works
  • if (selected{$question},'choice'),true,false) will not do anything

I added a brief warning to the blog above so others do not run into this issue.

Thanks!

SarayutMoonmuang1
New Contributor

Hi, Ismael

I am trying to filter choices for select_multiple question but it seems the choice_filter is not yet supported for select_multiple question? Or maybe I did something wrong.

Here's an example of my xls form.

survey sheet

choices sheet

Can you confirm whether it is supported for multiple choices yet?

Thank you very much!

Sarayut

JamesTedrick
Esri Esteemed Contributor

Hi Sarayut,

Yes, choice filtering does not work on multiple choice questions at this time.

KevinRobert1
New Contributor III

Is it possible to add a comment/text right next or right under a selected choice in a multiple select?

JamesTedrick
Esri Esteemed Contributor

Hi Kevin,

It's not possible to add additional comments; you would need to include them in the label for a choice.

OdonchimegAyush
New Contributor II

Hi James,

When does it work on multiple  choice? I just updated my survey connect. it seems like doesn't work.

JamesTedrick
Esri Esteemed Contributor

There hasn't been any change in behavior - choice filters do not work with multiple choice questions.

RobertWeber
New Contributor III

Ismael Chivite Is there an easier way to break out the responses to a Select Multiple question type?  For instance if you require 3 choices from a choice list is there a way to use a regex expression to separate the responses and populate three other fields with those actual responses, not 1,0 or true,false?  I do not want to have a separate field for all the choices in my list.  I need to be able to write each choice into Keyword1, Keyword2 and Keyword3 fields.  Seems like in order to do this if I understand the suggested procedure correctly would be to use if(selected{$question},'choice'),'choice','') for every value in my list which is over 100 choices long.  This seems prohibitive.  

JamesTedrick
Esri Esteemed Contributor

Hi Robert,

You can break out responses of a select_multiple question with the selected-at(<question>, <position>) function - that will pull out a specific answer.

DougBrowning
MVP Esteemed Contributor

What is the status on choice filters and select multiple?

As anyone got a good work around?

We have a list of species that should be filtered by state.

thanks

JamesTedrick
Esri Esteemed Contributor

Hi Doug, 

There is no update on choice_filter and select multiple - this is still not supported.

Just to confirm, the behavior you are looking for a select_one value being used to cascade to a select_multiple?

DougBrowning
MVP Esteemed Contributor

Yes.  In this case we have a list of potential species based on the state.  So if the user picks CA then the list of potential plants is narrowed down to just CA plants.  Then in the select_multiple list they can check the boxes for each plant they see.  For now we have to make it a repeat with a select_one.  Which is of course slower when you are rapid fire logging plants you see around you.

I have it all working great for a select_one - just want to be able to do it with multiple.

Thanks!

KatherinePadilla
Occasional Contributor

Hello, per the online documentation select_multiple questions "are stored differently than others, with each checked answer entered in the order it was selected, separated by commas. For example, selecting answers A and B in that order will present the response as 'A,B'."

Is there a function that allows the data to be stored in the choice list order or alphabetical order etc?

I know of a brute force way that requires one to account for every possible selection and would require updating any time the choice list is updated.  I would prefer a quicker way that requires less maintenance.

JamesTedrick
Esri Esteemed Contributor

Hi Katherine,

There isn't a method to set the order of choices - it records the order in which the user selected them.  You could make an Arcade script to order the choices - using the script at https://community.esri.com/groups/survey123/blog/2018/10/10/labels-for-multiple-choice-questions-usi... as a template, replace

var values = Split(inField, ',');

with

var values = Sort(Split(inField, ','));
PatrickCrushell
New Contributor III

I am attempting to do as you set out above in relation to writing selected multiple choices to multiple fields in a feature service. Unfortunately when I look up my data in resulting feature service, while expecting either a Y or N depending on whether selected or not, the following error message occurs throughout all of the relevant fields:

ReferenceError: Y is not defined in expression: if(selected( /PMP_Peatland_Scorecard/group_a/p_negative ,'bramble'),Y,N)

I believe I followed exactly what you suggest above - the calculation I used in connect is:

Appreciate any advice..??

PaddyC

DougBrowning
MVP Esteemed Contributor

You need to quote strings.  So "Y" and "N".

PatrickCrushell
New Contributor III

super, that's sorted - thanks Doug!

PatrickCrushell
New Contributor III

Can anyone explain why some multiple choice questions write answer to feature class as choice label while others write answer as choice name...? has it to do with whether there is text or numeric characters in the choice name?

DougBrowning
MVP Esteemed Contributor

I think it is always the name stored.  It could depend on where you look at it.  In a Web map it will use the domain to show you the label.  If you export it will show the name.  If you look in Map or Pro you can flip between them.

My guess is you added to the choice list after the first publish.  123 only creates domains on the first publish.  They do not update which can be a pain.  

For example if list was

One 1

Two 2

then you added

Three 3

You would prob see 1, 2, Three since Three has no domain.

There was a post yesterday on how to update them.

Hope that helps.

PatrickCrushell
New Contributor III

Final question on topic of multiple choice..

See screen-grab below -  

I have two choices (out of a total of 5) in a select single question that have the same name "0" but different labels. They need to have the same value as a name as I am doing a calculation based on the value. I am having two issues with this:

1. Survey123 does not allow me to just select one of the choices in the form as it automatically selects both, no way of just selecting one of the two. Is this always the case if two selections have the same name?

2. and secondly, as it writes the name to the feature service I don't have any way of identifying which choice of the two was selected....

any suggestions..???

GabrielGarcies_Ramon1
New Contributor II

Hi,

I have recently created a form following this post. I have a multiple_choice question, which also populates hidden integer fields via the method Ismael Chivite explained above if(selected...)  I also have a Repeated questions group and everything works well.

The issue I have noticed comes later, when I try to edit the form with another trick from an Ismael's post (URL?mode=edit&globalId={...}). Every field from the feature service updates correctly, the multiple_choice question and other string questions in the repeat, as well. But those hidden fields (stored in the repeated elements table with a binary value) do not change when I update the values in the multiple_choice questions. And they should also change, since they depend on the multiple_choice answers.

Hope I have been clear. Any suggestions to solve it? https://community.esri.com/migrated-users/3966 Thank you,
Gabriel Garcies

KateCarlson
Occasional Contributor

Great blog post!  I have a question regarding the hidden fields... I need to do this after the fact, our survey has already gone out and it will be ongoing. We will create a web app that filters the different choices from the select_multiple question. To add the hidden fields requires a schema change, is there a way around this by chance?

Thanks for any insight offered-

Kate

KateCarlson
Occasional Contributor

To add to my question, is this a possible workflow?

  1. Continue to use the same survey form to collect data.
  2. Create a copy of the dataset to add the additional fields that isolate the select_multiple choices.
  3. Use this copy to present data in a web app that allows for filtering by these choices
  4. Create a script (i.e. in a Notebook) to run #2 above every so often, replacing the copy with the updated dataset.

 

OR... 

  1. Add hidden fields to the form and republish, creating a new hosted feature layer
  2. Append the data collected previously to this new hosted feature layer (adding the hidden fields in AGO to match the new schema)

Any recommendations?

Thanks!

Kate

DougBrowning
MVP Esteemed Contributor

I am late to this but do you need the fields to be posted and available in the attribute table?  If not and you just need them in the form, you can set the bind esri column to null and the fields will not be added to the feature service and thus not a schema change.

Not sure if that works for you but thought it may help.

KateCarlson
Occasional Contributor

Hi Doug, thanks for responding, and you are right on time!

I do need them to be in the attribute table so I can create filters in the final app. I believe this will require the additional fields?  For example, a survey question has 3 choices; x, y, and/or z. In the app, I want viewers to be able to show all x or all y or all z locations (via filter widget). 

Thanks-

Kate

DougBrowning
MVP Esteemed Contributor

Have you tired using contains instead of equal in the filter?  Not sure what your data looks like.

KateCarlson
Occasional Contributor

Great suggestion, I was over thinking this. This will work! Thanks, Doug.

Kate

DougBrowning
MVP Esteemed Contributor

This came up for me again on the same form today. I found my own post.

The crew is saying using a select one in a repeat is just way too slow. Adding 45 mins to the process. Since the list is not that long they want to try select multiple again.

But still no way to use choice filter? This post goes back 2 years now so is there any timeline on this?

The other fast way would be to grow a repeat down in a grid. I have got asked for this every single week for the last 3 years I think.

Speed on our forms comes up again and again. So I have to vote again for the UI team to really focus on that. I still wonder why speed has not been a priority. Number 1 complaint in 123 is - clunky. It is slower than 10 year old software which makes me not look so good.

Anyway my idea so far is to have 1 field per state and then use relevant to show the state specific one. For now we have 11 states so long but doable. Converting it later to a repeat looking table is going to be a nightmare though. Unless coalesce may work - Well nope since it can only take 2 values for some reason.  Would be nice to have many.

The other big issue is spaces. I really need them. So now I need a script that will remove underscores (since still no replace formula), split on comma, combine 11 fields, and turn it into a record per species!

As you can see I am running into multiple limitations here just to do a simple pick list. So BIG vote up to get some of this prioritized vs the rarely used funky stuff.

I also vote to use ; instead of ,.

Open to any other ideas.  I am drowning here a bit.  I cannot get crews to adopt 123 of it adds 2-3 hours on to their day.  I am getting these comments in 5 dif programs.

Thanks!!

LNvoyageuse
New Contributor

I am trying to build a multiple-choice question and convert the "other" option into a text line. I cannot seem to find a way, and previous answers seem to agree that comments are not allowed into a multiple-choice format. Is there any trick one could use? Thanks!

MichaelBruening
Occasional Contributor

@LNvoyageuse one way that I have gotten around this is to name my multiple choice question that has the "other" choice to MyQuestionTemp. Then a create a hidden question that is "MyQuestion" and this question will hold the results of joining MyQuestionTemp with MyQuestionTemp_Other answers.

I usually palace a conditional if() statement that will only complete the joining of the two questions if the "other" option has been used. There might be a more stream-lined approach to this, but this works for me and allows me control on how they are merged together.

3DMS
by
New Contributor II

@LNvoyageuse 

if I understand you correctly, you could simply add a new text type question under your multiple question that is only relevant when your multiple question returns "Other". Hope that helps although it is kinda late.

 

My question about using select_multiple is, if there is way to store the individual answers of a select_multiple question in new attribute fields. So far i do that with an if-statement (if(selected(${select_multiple question}, 'name of the choice'), 'text of answer', ''). I think that is not the most efficient way as i have to write both my "choice name" and "label".

Any help here is gladly appreciated. Thank you! 

ryanEvanczyk
Occasional Contributor

Hi @IsmaelChivite ,

Looking for help/ideas on breaking out select_multiple data.

I have a list of employees in a select_multiple question for "On Duty?" and I want to show on an indicator the number of days an individual worked (or on a serial chart). However, the number of employees is large and in flux, so adding a hidden field with the if(selected{$roster},'employee'),1,0) calculation for each employee seems like the wrong solution. Any other ideas?

MohammedAlBorneih
New Contributor

Hi Everybody, 

I have a question, and I didn't find any answers yet from any reference.

I have a questionnaire, ask the field officer to enter how many are the total beneficiaries, and after that, I have a question with multiple choices. 

I need to know how many are the total beneficiary choose choice 1, choice 2 .. etc 

I can know how many sessions enter choice 1 or two but I need to connect these choices with other data!

Thanks in advanced 

 

 

santamariaa
New Contributor III

Is it possible to set the delimiter in the Survey to something other than "," for storing the results of a multiple select? Or is this auto-generated?  

PaulPetersen1
Occasional Contributor

@santamariaa , you can use javascript with pulldata() to do this.

The snippet below (place in the calculation column) replaces commas with semi-colons...could be changed to whatever. 

pulldata('@javascript', 'functions.js', 'findandreplace', ${fieldname},',',';')

Which calls this javascript function (in the scripts folder): 

function findandreplace(inStr, findstr, replacestr) {
return inStr.split(findstr).join(replacestr);
}