Design question - data structure for questionnaire

Hi all,

We need to develop a big questionnaire with multiple questions (around 50) and I am wondering how to design the data structure. I think we should avoid a big CDT with 50 fields. Instead of that I am thinking of a generic CDT to store each answer, processId, question number and a couple of minor details and persist the information in the DB. 

What do you think? What would be the best practice here? Am I right thinking that a big CDT with 50 fields is not recommended?

The questionnaire will be splitted into multiple tasks for different people. Each person will answer different questions. A workflow process is clearly needed.

Kind regards

  Discussion posts and replies are publicly visible

Parents
  • I've built this kind of thing in the past. I design one table to hold the questions, along with any meta-data about the type of question (e.g. is the answer to the question a 'Yes/No' choice, or a choice of 3 values, or some text that needs to be captured etc); and then a table to hold the answers to the questions (along with a pointer to the question type in the first table). And the code in the SAIL interface essentially dynamically builds the interface based upon the content in the first table, and writes out the answers to an array that gets written to the second table. In this way you can not worry about adding or removing questions from the set because you can add or deprecate rows from the first table and the interface will simply dynamically render the interface based upon what it can find at run-time. You'll find the CDTs are much smaller in terms of their attributes, but the code does become trickier do deliver. But once implemented you'll only need to make changes to the design if you have to add a different type of question (i.e. one that requires a different answer type to the ones you've already delivered).

  • Thanks Stewart, that is my view as well. I feel much more comfortable now with the design.

Reply Children
No Data