Select to view content in your preferred language

Add record to Repeat based on multi select choice?

1102
4
02-06-2017 01:49 PM
TL2
by
Occasional Contributor III

I would like to have a series of questions that have a Pass/Fail option that when Pass is chosen, a record is added to a repeat (related table). 

My goal is to make each Pass or Fail question become one record in a table.  If I have 10 Pass/Fail Questions and the operator selects all 10 as Pass, the resulting table will have 10 entries, each entry will be the Question and the status (pass/fail).  

I can not figure out if this can be done using only Survey123.  I have tinkered with GeoEvent too but that will not handle attachments.  

Any suggestions?

0 Kudos
4 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Tucker,

Just to be sure, you're wanting to transform (simplified example with 2 questions):

NameQ1Q2
AlicePassFail
BobFailFail
CathyPassPass

into:

NameQuestionResult
AliceQ1Pass
AliceQ2Fail
BobQ1Fail
BobQ2Fail
CathyQ1Pass
CathyQ2Pass

?

If that's the case, the simplest way to do this in Survey123 would be to structure the form as a repeat, with any data that is uniform for the survey (like 'Name' in the table above) being entered before the repeat and then be placed into the repeat using a calculate question.

That being said, my normal instinct would be to manipulate the first table (one row per measurement) in the database after submittal.  A couple of ways to do this - the 'Transpose Fields' tool in ArcGIS Desktop can do this to create the new table out.  The appropriate SQL command is UNPIVOT (see the bottom example of Using PIVOT and UNPIVOT ), which could be used to make a view of the original table.

0 Kudos
TL2
by
Occasional Contributor III

Thanks James, you are understanding me correctly.  I will look into these options, thanks for your help!

0 Kudos
TL2
by
Occasional Contributor III

James,

I like the repeat idea.  One hurdle I am experiencing is that the calculate option calculates all related fields based on whatever is last selected.  As you select another Name to populate a repeat row, it updates all the records in the repeats with that name...

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Ah- I hadn't realized that the name would change- I was assuming 1 survey form per person.

0 Kudos