I'm creating an application that requires users to answer several questions and based on answers to those questions, certain conditions result, such as the ability to view certain sections of the questionaire and/or more questions appear and/or some questions become irrelavent and/or mathematical formulas work one way or another based on an answer to a question.
Here is an example:
The user has to answer a question. For this particular question, if the user chooses Yes then I must "Activate" all of the questions that are flagged with the code X. If the user chooses No then I must "Activate" all of the questions that are flagged with Y and "Deactivate" all of the questions that are flagged with Z.
I'm coming across a design issue (both with the application itself and the database). What is the best way to store all of this in a database? Should I store the questions along with the list of possible answers and their corresponding conditions in the database as well as the actual data for each record (each questionaire)? Should I be referencing the database to populate all of my questions on my VB form or should I manually put labels and combo boxes containing the questions and possible answers on my form? Or should I be using another technology to store my questions and conditions OR my results, such as XML?
I looking for suggestions. I want to optimize my program as much as possible. I don't want to slow it down by making several calls to the database, but I want to make sure I'm also taking away optimization by hardcoding everything.
Thanks for your time and help!
After many suggestions, I've decided the best bet is to store everything possible in a database.
It's great because my application will be flexible. However, I'm a bit confused on the best way to store data about the application in the database, such as forms, controls (labels, combo boxes, etc). Has anyone worked with creating a form by using a recordset containing it's corresponding controls? I'm not even sure what to call it.
Picture an explorer style application. On the left in the treeview are sections of a questionaire. When you click on the section, the corresponding questions (labels and combo boxes) appear on the right in a panel. When a section is not yet complete that section name on the left appears in red (a flag is needed to indicate whether it's complete or not or not applicabile in the current situation). On right in the corresponding panel, are all the questions relating to that section, some of which have conditions associated with the answer. See above for an example. Has anyone worked on something similar? Where you are querying data to get the contents of your form, then saving chosen data into record? One section of the database would be for loading the form and another section would be saving actual data collected.