Random List - XLS Advanced Form

2618
12
09-01-2017 06:43 AM
CraigMcIntyre1
New Contributor II

Hello,

I am somewhat new to Surey123 and I'm beginning to create a new survey using the XLS advanced form.

In a nut shell I am creating a cleaning audit, the user will select which unit they are at then score rooms based on cleanliness.

However I am having trouble with being able to show a random sample of rooms to be checked. I know what rooms are in each unit. 

For example:
I enter Unit A, upon selecting Unit A on my survey the next 5 questions should be the rooms that are to be audited. Which should be randomly populated from the master list of rooms. i.e Room G1, Room 3.4, Room 5.6 etc

I'd appreciate any help in regards to this.

Thanks Survey123 for ArcGISsurvey123 app#

0 Kudos
12 Replies
by Anonymous User
Not applicable

Hi Craig,

To better understand your use case, would you be able to share your current survey xls form? In the meantime here are a few initial questions:

Are the room types for each unit type set up as choice lists, or are they set up as different fields?

Are the set of questions for each unit type and/or room type the same?

Are you planning to use repeats for the questions associated to rooms? Or are you just wanting to hide questions based on relevance and the random selection of rooms?

Regards,

Phil.

0 Kudos
CraigMcIntyre1
New Contributor II

Hi Philip,

I've uploaded the file within the Survey123 community page.

As you'll hopefully see from the file, it is still very much a rough draft. The idea will eventually be that you select a school i.e Arkleston

Then the questions about scoring each room would be a random choice from the last list of rooms within Arkleston.

The questions will be the same for each unit, however the room types will be different. i.e Arkleston may have rooms called Room0.2, Room 3.4, Room 2.4

However other units may have rooms titled differently.

Hope this is of help!
Thanks

0 Kudos
by Anonymous User
Not applicable

Hi Craig, I don't see the attached file. You can add it to this post using the Advanced Editor and attach file.

0 Kudos
by Anonymous User
Not applicable

And just to try and understand further, do you want the questions to be random or the selection of the choice list in the questions to be random?

0 Kudos
CraigMcIntyre1
New Contributor II

The choice list of rooms per each unit is to be random.

Each unit will be asked the same question which will essentially be "How clean is this room?" - But the room the audit takes place in must be random.

I've now attached the file within this post.

Thanks 

0 Kudos
by Anonymous User
Not applicable

Hi Craig,

Thanks for the copy of your xls form. There is currently no "easy" way in Survey123 to randomize the selection of values from a choice list using text strings and populating other fields based on this random selection. However it is possible to randomly select a number between a range, as you have done in your xls form. We do have a feature enhancement logged for indexed repeats which may assist in using repeats in your survey to randomly select the values (rooms) used in the next repeat record, however there is currently no timeline on implementation of this feature.

I notice you do not have a room choice list for all the rooms in your xls form yet? Do you have that list and could you populate each room name with a number as the name, the label as the room name and then add a new column called school and populate which which schools they belong to, to help filter the relevant list of rooms based on school selection from previous question. You then need to add a new field called Room Name to each of your Room Audit set of questions, and repeat it 5 times. If you then apply numbers to each it may be possible to use a hidden filed with random calculation or null esri field types (to be released in version 2.4) to do the random number selection, then based on that number returned, select the number from the choice list from the school it applies to. You may need to include some if statements on each room question though to ensure the same room is not selected twice or more.

Hope that helps.

Regards,

Phil.

0 Kudos
TimothyKing2
New Contributor III

I have a somewhat similar question, wherein I have a choice list of 133 safety topics that I would like to show a random one each time the survey is taken.  It is more of a reminder to talk about a safety topic before beginning work.  It looks like this may now be available in 2.4 and I will have to look at the null esri field.  Any help would be appreciated!  Thanks,

0 Kudos
MarikaVertzonis
Esri Regular Contributor

I did some exploration and although what Id like to be able to suggest is the ability to set a default value for a select_one question, something like this:

I found this didn't work .

We will explore the behavior of defaults and calculations some more, but in the meantime I was able to succeed with pulldata(). In the following example I moved the the random calculation into a calculate question, and instead of storing my list of values in the choices tab, I put them in a file called randomactivities.csv in the surveys media folder. This is what the .csv file looks like:

Then back in my survey, in a text question I used pulldata() to return the id from the .csv file that matched the random number generated in the calculate question and displayed the corresponding action:

The result is this:

TimothyKing2
New Contributor III

That worked great Marika!  Thanks!

One thing, do I need to have the randomchoice text and number show up, I would rather just have the saftety tip show up. 


Thanks,

LTK

0 Kudos