Sawtooth Software: The Survey Software of Choice

Library       Read Database

Reads values from the survey database.

  Download

Description

Reads all previous responses for a given question. Any operations can then be done with this data.

Instructions

  • Line 3 should be set to the name of the question whose responses will be read from the database.
  • Line 4 should be set to the data table where this question is stored. This is most likely the name of your survey followed by _data1.
  • Lines 6-9 must be filled with your database credentials.
    If you are using Sawtooth hosting, sign in to hosting.sawtoothsoftware.com and navigate to the survey settings:
    • $databaseName likely looks like db_XXXXX.
    • $databaseUser likely looks like user_XXXXX.
    • $databasePass should be a long string of random characters.
    • $databaseHost should be a URL.

Options

  • From line 26 on, you can write whatever Perl you wish. You could return the number of times a response appears, or determine if the newest response is a repeat, or anything else.
  • To have the Perl array returned as a JavaScript array, switch 0 with 1 on line 35. Before doing this, know that this will make it possible for any respondent to see the answers from previous respondents for this question. If responses to this question need to remain confidential, do not make this change.

Notes

You will need to upload your survey to test that this question is behaving correctly.

 Usage Terms     Read Question Library Help

Community Question Library

Explore Question Library

Beginning with Lighthouse Studio 9.3, you may create a personal question library with your favorite questions. This page contains survey questions that have been submitted by our user community. You may download the questions and then import them into your Lighthouse Studio question library and freely use them within your surveys. All of the amazing items in this library are entirely user-contributed and user-supported!

Explore Question Library