SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 how to handle tons of questions...
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

jhermiz
Flowing Fount of Yak Knowledge

USA
3564 Posts

Posted - 05/03/2004 :  13:47:32  Show Profile  Visit jhermiz's Homepage
Im creating a small wizard to allow our business guys to answer some questions. The answering of these questions will help the end user choose the correct template for the station that he / she is trying to build.

Questions can be like so:
Is section monitoring required [IF YES THEN CHOOSE COMPONENT T720]
Are dual palm buttons required [IF YES THEN CHOOSE E0416]
Is a pneumatic plate required [IF YES CHOOSE T100]

....

There are abot 40 different questions....all of which can be yes's and no's...the yes's will allow the component to be added to basically their BOM. How should I handle these questions on the database side? I need to first store the questions themselves..and prolly feed them to my front end since they may change. But how should I store the answers etc...

I want to do it the right way and right now all I can think of is to actually store the question and a bit to flag it as yes / no???

Thanks,
Jon

MichaelP
Jedi Yak

USA
2489 Posts

Posted - 05/03/2004 :  14:35:52  Show Profile  Visit MichaelP's Homepage
The way I've done this sort of thing is have a table for Questions, and another table for their related possible answers (one row per answer per question).

I then create other tables that store a user's answer's to a particular set of questions.

Does that help? Let me know if I need to be more specific.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz
Flowing Fount of Yak Knowledge

USA
3564 Posts

Posted - 05/03/2004 :  16:56:08  Show Profile  Visit jhermiz's Homepage
Can you be more specific...

I understand the table of questions not a problem.

But the only choices the end user may potenitally (bad bad spelling) have is Yes / No...there are a few that actually ask for a quantity...but how are you storing the rest? Do you relate a questionID to an Answer???

Thanks,
Jon
Go to Top of Page

MichaelP
Jedi Yak

USA
2489 Posts

Posted - 05/03/2004 :  17:43:31  Show Profile  Visit MichaelP's Homepage
Ok, I've got a Question and Answer tables. A Question can have Many Answers. You can have different QuestionTypes or AnswerTypes to handle how to prompt the user (a Textbox vs radio buttons). This does sorta suck for a yes/ No type answer, but if you do it this way, You can easily see what questions a user has answered, and which one's they've yet to answer.

I then have a Users table. When a user answers a question, I have a Many-to-Many table that contains a UserID, an AnswerID (from the answer table), and an AnswerValue column. Think of this as "an instance of an Answer". Depending on the type of question, I'll put diffferent stuff in that value colum (1/0 for yes no, or a string of text for a textbox).

For my application, I also made groups of questions into a survey. Each user was allowed access to one or many surveys. When they logged in, I determined what they could see. Once they choose a survey, I knew what questions and what answers to those questions I needed to display.

HTH!

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000