Author |
Topic |
|
kolucoms6
Average Member
845 Posts |
Posted - 06 January 2008 : 05:23:34
|
I have few questions and with multiple options as an Answer.
Now, lets presume there are 4 questions : A,B,C,D and in each one , Options are as YES or NO.
Now, if answer to A is Yes, then only candidate can answer B.
if answer to B is No, then only candidate can answer D.
A and C is not deopendent on anyone.
I have created a db Something like that ;
Question.QuestionID Question.Code Question.Question Question.[Dependent?] Question.DependentQuestionID
Question.[Dependent?] is a Boolean Type which says whether the question is dependent on another question or not.If yes, then Question.DependentQuestionID is there.
But No idea how to disp-lay data in ASP pages.
Any help ? :confused:
|
|
kolucoms6
Average Member
845 Posts |
Posted - 06 January 2008 : 06:32:59
|
Here is the some code which i am using in ASP :
quote:
Do until adRsQues.EOF Response.write "<tr>" Response.write "<td>" & adRsQues("Code") & "</td>" Response.write "<td>" & adRsQues("Question") & "</td>" adRsQuesOptions.Filter="QuestionID=" & adRsQues("QuestionID") Do until adRsQuesOptions.EOF Response.write "<td><input type=radio name=" & adRsQuesOptions("QuestionID") & "-" & adRsQuesOptions("QuestionOptionsID") & " value=" & adRsQuesOptions("Option") & ">" & adRsQuesOptions("Option") & "</td>" adRsQuesOptions.MoveNext Loop Response.write "</tr>" adRsQues.MoveNext Loop
|
|
|
kolucoms6
Average Member
845 Posts |
Posted - 06 January 2008 : 06:34:35
|
For Example : If candidate select YES for A, then only Question B shld be displayed else no. |
|
|
gary b
Junior Member
USA
267 Posts |
Posted - 06 January 2008 : 08:14:26
|
You could use either a flat database or a relational database. (From your description, it appears that you have a 'flat' database.) The code will be different -- depending on the type of database used.
For flat database, minimum 1 table with minimum nine fields: PKID, QuesA, AnsA, QuesB, AnsB, QuesC, AnsC, QuesD, AnsD
The ASP code to display should follow this outline: Retrieve all records If AnsA Then Display AnsB If AnsB <> True Then Display AnsD End If Else Display AnsC End If (Modify last 3 lines if AnsC should always be displayed.) '---------------------------------------------------
For relational (dependent!!!) database, three tables: tblA fields: A_PKID, QuesA, QuesB, QuesC, QuesD, AnsA, AnsC tblB fields: B_PKID, A_PKID, AnsB tblD fields: D_PKID, A_PKID, AnsD
In this approach, AnsB does not exist unless AnsA is a predetermined value!! Same goes for Ans D -- it does not exist unless AnsB is a certain value. To me, this is easier approach because: #1 The database design establishes the 'dependencies' #2 You do not need to record every question for every record #3 You do not need "decision logic" in the ASP code -- as above. #4 The SQL will retrieve only the records you want because the 'dependency logic' is in the JOINs #5 Write code to basically display entire recordset.
I am counting on the database gurus to correct any errors. I hope this made sense... |
|
|
kolucoms6
Average Member
845 Posts |
Posted - 06 January 2008 : 08:22:03
|
Thnx for your Quick Response.
But number of questions are NOT fixed.
I have mailed you the db design in mdb format.
|
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 07 January 2008 : 08:24:18
|
quote: Now, if answer to A is Yes, then only candidate can answer B.
if answer to B is No, then only candidate can answer D.
If dependency is also related to what the answer is, I would think you would need another column to hold that value. |
_-/Cripto9t\-_ |
|
|
kolucoms6
Average Member
845 Posts |
Posted - 07 January 2008 : 14:20:48
|
I have it :
quote:
Question.[Dependent?] Question.DependentQuestionID
Question.[Dependent?] is a Boolean Type which says whether the question is dependent on another question or not.If yes, then Question.DependentQuestionID is there.
|
|
|
|
Topic |
|
|
|