How can I pull survey results out of my exports in a human-readable way?

Basyl Durnan
  • Edited

We received a great question about how to look at survey results that doesn't involve combining multiple export files.

Try using the below SQL query on the Export Explorer tab, replacing "Medication Adherence" with your survey name. You can then click "Download Results" to get a CSV of your data!

SELECT 
  sqr.participantidentifier,
  sr.surveyname,
  sr.surveyversion,
  ssr.stepidentifier,
  sqr.resultidentifier,
  sd.questiontext,
  sd.answerformat,
  sd.answerchoices,
  sqr.answers,
  sqr.startdate,
  sqr.enddate
FROM surveyquestionresults sqr
JOIN surveystepresults ssr
  ON ssr.surveystepresultkey = sqr.surveystepresultkey
JOIN surveyresults sr
  ON sr.surveyresultkey = sqr.surveyresultkey
LEFT JOIN surveydictionary sd 
  ON sd.surveykey = sr.surveykey
  AND sd.surveyversion = sr.surveyversion
  AND sd.stepidentifier = ssr.stepidentifier
  AND sd.resultidentifier = sqr.resultidentifier
ORDER BY
  sqr.participantidentifier ASC,
  sr.surveyname ASC,
  sqr.startdate ASC

1

Comments

0 comments

Please sign in to leave a comment.