I am designing a Surveying system for a small project in our community.
But somehow I am getting stuck on how to properly design the system in such a way that
it can be configured at the database side.
My use case is like this:
It’s some sort of a survey system where user is ask a series of questions and depending on their answer
another question would be ask. I am planning to show this as step/wizard pages.
| --- Answer C --> End Survey
|--- Answer A --- Q2 ---- | --- Answer D --> End Survey
Q1 ---> | | --- Answer E --> End Survey
|
|--- Answer B --- Q3 --- | --- Answer F --> Q7 ---> End survey
| | --- Answer G --- Q8 --- | Answer H --> End Survey
| | Answer I --> End Survey
| | Answer J --> End Survey
--- Q4 --- End Survey | Answer K --> End Survey
In my diagram, user is first shown Q1 (Question1), if his answer is A, then Q2 will be presented with a list of answer’s (C, D, E) then the survey
stops.
But if user answers B, then he will be shown Q3 + Q4 on the same page. If user answer F on Q3 then next question is Q7 and on and on.
I am thinking of creating a QUESTION table to hold the question and a QUESTION_ITEMS table to hold the list of answers but how do I handle the state transition?
I am actually stuck on how to properly support this kind of requirement where user is able to configure the
question list.
Any thoughts?
My target DB is MYSQL by the way.
Thanks
I think it makes sense to have questions and questionitems (aka answers). Then all you need is to link each question_item to its follow-up page. Group the questions together by using a separate column for page.
Questions
Question_Items
Etc …