Best Way to Build Multiple Choice Survey with 300+ Questions

Hi, we are migrating a survey from SAP Qualtrics to AppGyver and want to find out the best way to achieve this. The current survey has over 300 questions and is a business requirement. Each question is multiple choice, where “yes” is 1 point, “no” is 0 points, and “N/A” does not get included in total score.

What is the best way to go about building this in AppGyver? The workload looks enormous if we try and build each question manually.

Try building your own multiple question choice system in javascript and plug the input to a variable that is a list of questions (which you store in a DB I presume). And have 4 outputs: [0] for ‘yes’, [1] for ‘no’, [2] for ‘n/a’ (you mean null?), [3] for ‘error’.

1 Like

What @Fred_Kuzyk said is a good option and it’s much better using JavaScript. If you have knowledge of JavaScript, you can follow @Fred_Kuzyk’s example and it would look something like this:

// Create a list of questions
const questions = [
  "Do you like pizza?",
  "Do you like dogs?",
  "Are you allergic to cats?"
];

// Create a variable to store the answer for each question
let answer;

// Loop through the list of questions and prompt for an answer for each one
for (let i = 0; i < questions.length; i++) {
  answer = prompt(questions[i]);

  // Check the answer and assign it to a variable to be processed and stored later
  switch (answer) {
    case "yes":
      answer = 0;
      break;
    case "no":
      answer = 1;
      break;
    case "n/a":
      answer = 2;
      break;
    default:
      answer = 3;
      break;
  }

  // This is where the answer would be processed and stored (e.g. in a database)
  console.log(`Answer to question ${i + 1}: ${answer}`);
}

In this example, a list of questions is created and stored in a "questions" variable. A "for" loop is used to loop through the list of questions and "prompt" is used to prompt for a yes, no, n/a, or anything else answer. The answer is checked using a "switch" statement and assigned to an "answer" variable, which would later be processed and stored.

Remember that you can have more ideas by searching and this way you will have a wide range of knowledge and doubts with the AppGyver community. Greetings.

1 Like

In case you have any chance of having the list of questions as a .csv, or a .json file it could be managed in a pretty clever way in both of the answers on top. I would add that depending on the backend structure you could come up with multiple scenarios:

In case of Firebase:

  • have a collection of ‘questions’ where each item is a json object with a schema like this:
{
  "id": "random-generated-by-firebase"
  "questionText": "Do you eath healthy?",
  "answers": [{
      "value": "yes",
      "score": 1
    },
    {
      "value": "no",
      "score": 0
    },
    {
      "value": "N/A",
      "score": null
    }]
}

In the app when you are building your logic and layout keep this in mind:

Make a page variable or app variable (depends on use case) which is a list of “texts”.

Then as a layout you’d build a repeated container, which is repeated with the data variable “questions” (that is coming from Firebase).
Inside that repeated container, you have a text that is the question text, and another repeated container that is repeated with the answers array of the question object.

On the answers repeated container a component tap event should trigger a set page variable logic where you add a new item to the list of questions (if the questionaire is “no-going-back” type). For this you can use a formula like this:

WITH_UNIQUE_ITEM(pageVars.responses, {questionId: repeated.question.id, answer: repeated.answer.value, score: repeated.answer.score})

When the user reaches the “Submit” button, there you’d have a logic that does this formula:

SUM_BY_KEY(pageVars.responses, "score")

Wherever you save the above formula value will give you the final result.

The solutiion and approach is similar to any backend that you choose. Some might be easier to import a big dataset like these 300 questions. But with a csv to json converter you could be good.

1 Like