How does Survey123 automatically answer questions from answers to previous questions?

1430
6
04-15-2019 07:41 AM
KaitlynAbrahamson
Occasional Contributor

I am struggling with which columns to use for a series of questions in my survey.  What I need from my survey is the ability to answer multiple questions directly from the previous questions in my survey.  For example, the signing project I am doing requires a question for 'sign type,' 'sign quantity,' 'post quantity,' 'post dimensions,' and 'post height,' and all these questions are intertwined depending on the 'sign type' answered at the beginning of the survey.  A couple specific examples are as follows:

1.    If sign type is equal to 'stop sign (36x36)' the post quantity should automatically default to '2 posts' and the post dimensions should be 'square tube.'

2.    If sign type is equal to 'any kind of object marker (All OM sign types)' the post dimensions should be 'u-channel' and the post height should be '7 feet.'

               -side note: One type of object marker need a default of '0 posts' to give context on how complex this survey is                going to have to be.

My struggle is with which columns I should be using to decipher this information, what calculations, and whether or not this survey is too complex to make efficient.  There are over 200 sign types I am working with, so I originally thought using the pulldata function was the best way to sort out the categories of signs.  I have used relevant statements to add questions if necessary.  I also began trying if statements, but those seemed challenging due to the amount of sign types there are.

What am I doing right or wrong?  How should I be sorting my data?  Does anyone have any recommendations?

I have attached my data to make this question easier to answer.

0 Kudos
6 Replies
BrandonArmstrong
Esri Regular Contributor

Hi Kaitlyn,

It sounds and looks like you are doing everything that you should be doing in arranging your survey.  Is your concern related to performance, or the time and effort it will take to set it up?

I would continue to use pulldata to populate the post quantities and post dimensions for each sign type.  Just add another column for each in your CSV which can be used to pull from. You can place the pulldata calculation in the calculation column of the select_one question. So, for your select_one signCount  question you can put pulldata('signcatalog','<quantity value>,'signnumber',${signtype}) in the calculation column.

With the use of pulldata and 'calculate' type questions you will be doing the heavy lifting for the survey submitters by preventing them from having to enter in information while at the same time ensuring the data integrity.  There's more than one way to peel an orange but I think that your method should work!

Let me know if this makes sense and if you have questions related to the method proposed.

Best,

Brandon

0 Kudos
KaitlynAbrahamson
Occasional Contributor

Hi Brandon,

Thanks for helping me out; I've been in quite the rut.  My problem is that there is a current system available that is about 4 times shorter and I would like to beat it in efficiency, performance, and speed.  

The pulldata function works well for me; however, I need a way to edit the pulldata on the survey form in case it is not correct (there are many signs that don't fit the exact pulldata information or require different solutions).  Is there a way to edit the pulldata?  If not, what do you suggest I use?  

0 Kudos
DougBrowning
MVP Esteemed Contributor

Use an if statement.  So one field does a pulldata.  The next field does an if on that pulldata field to check if it found anything.  So something like if(q1='','use value since feature not found",q1)

Number of questions is not really a concern for the user.  If you can get the form fast the backend does not matter.

I did have a form that did some calcs like the above. In the end we took them back out because 1 - it did slow down the form since my lookups were huge and 2 - people were then using these temp calcs in actual analysis without doing QA and all that.

Also just to check - are your lookups and lookup values inside of a repeat?  I found a speed bug with that.

0 Kudos
KaitlynAbrahamson
Occasional Contributor

Thanks Doug.  That's a good option too.  My problem is that my calculated if statement does not have a quantity if the feature is not found.  Here's an example of what I want to be able to do:

Some signs require an input of the sign width and height during the time of inspection (this differs from stop signs that are always the same size no matter the location).  If I need to complete a survey for a sign saying you are crossing into a new county, that sign will differ in size depending on how long the new county name is.  I would like to have sign width, height, and area automatically calculated for predetermined (pulldata) sign, like a stop sign, and be able to input the width and height for custom signs before an automatic area calculation (most signs have a different area calculation).  

If I used an if statement, I'm not sure how I would even phrase it (I'm new to the XLS version of Survey123).  Here's the sign width example:

Am I on the right track with that if statement?  Can I or should I even use if statements?

Thanks!

Kaitlyn

0 Kudos
DougBrowning
MVP Esteemed Contributor

Change it from a note to text for widthnote.  Then use a calculation column of if(${widthcal}='','',${widthcal}).  (So you can use calculation even if the type is not calculate.)

Basically you prepopulate it but then let the user change it if they need to.  Then make it required.  That way if pulldata finds it - it uses it - else it is blank and then required will trip for the user if they try to skip it.

KaitlynAbrahamson
Occasional Contributor

You're awesome, Doug!  That works like a charm and you saved me so much time!  

0 Kudos