Are you trolling for compliments?
That should stop around the 11th grade.
Are you trolling for compliments?
That should stop around the 11th grade.
Discourse new motto: "Not just your ordinary offline website, but a VERY offline website."
@SomeDroneWorker "Ooooh, I just read this Design Pattern book, so I'm going to put it to good use. And that Factory Pattern? My Favorite! I'll use it everywhere."
Seen it, experienced it, nothing you can do but say "Oh $#!%"
If you need more disk space then you need to stop downloading porn. Nobody does that anymore, it's all streaming. Or so I heard.
I worked on a survey project awhile back. Hopefully it was similar enough(and I understand your requirements).
We had:
Survey table (had stuff like survey title, special instructions...)
SurveyToQuestions table (had F/K to SurveyID and F/K to QuestionID, and order of questions, assumed the same questions could be used in different surveys)
Questions table (we had a F/K to question type b/c some of the "questions" were actually breaking bars or special instructions, also had to account for predetermined answers like check boxes or free form text).
Answers table (F/K to QuestionID, and order of answer if multiple answers, like a checkbox/radio button, and a F/K to answer type, we assumed an answer could only belong to one question.)
Responses table (contained when a survey was administered, a few other fields)
Choices table (F/K back to Responses table, and F/K to QuestionID & and AnswerID, this is table that stored each question/answer a user chose on a survey. Also text field for free form entry.)
It sounds like you need to squeeze section into the middle of survey question like:
On the frontend we pulled the survey(by url), and the questions/answers into an object model. Looped through the questions, based on the question type and answer type we displayed the appropriate question (or special instructions).
foreach(Question q in Questions)
{
if (q.TypeID = QuestionType.RadioButton)
{
div tag: Show question <- use "id" attribute like this "QuestionID_qid"
foreach(Answer a in q.Answers)
radio button <- use "id" attribute like this "QuestionID_qid_aid"
}
if (q.TypeID = QuestionType.FreeForm)
{
div tag: Show question <- use "id" attribute like this "QuestionID_qid"
textarea tag: <- used "id" attribute like this "QuestionID_qid", there is no answer id for text boxes in the above datamodel.
}
}
NOTE: qid is QuestionID, aid is AnswerID(the actual values), you'll need these to parse on the middle tier to figure out what was chosen/typed in.
NOTE2: We added in an admin section so we could edit the text of the questions/answers as well thing like order w/out having to roll SQL code for every change. That paid for itself in gold(no development effort, small QA effort, all on the BAs to work w/the biz unit).
Hope this helps, but whatever you do, don't do EAV, it will end in tears. The only time I've seen it used was for a small setting table. For larger database designs EAV will end in tears.
@Lorne_Kates , your example & explanation was far better than mine.
I have to agree with some of the previous posters who recommended a "No Opinion/Neutral" option.
Are you trolling for compliments?
That should stop around the 11th grade.
@Vaire If movie theaters go out of business then how are young teenage boys going to learn how to get to second base where are young boys going to go on dates with girls?
It's been awhile for me too. Just curious from all the C++ folks...
What happens if the parameter (String alpha2) is null? When it hits the alpha2.isEmpty() method.
@SomeDroneWorker "Ooooh, I just read this Design Pattern book, so I'm going to put it to good use. And that Factory Pattern? My Favorite! I'll use it everywhere."
Seen it, experienced it, nothing you can do but say "Oh $#!%"
I have to agree with some of the previous posters who recommended a "No Opinion/Neutral" option.
9mm are nice, but they'll most like punch through people and/or walls. I'd prefer a .45 for the stopping power(it will knock you flat on your ass). A shotgun w/collapsible stock would also be nice.
Call me old school, but I would recommend the K & R C Programming book(2nd edition), it's one of the holy bible of programming. If you master that, nothing is outside your realm.
@Lorne_Kates , your example & explanation was far better than mine.
EAV (as I understand it) is something like this
Entity Attribute Value
EmpoyeeID int 86
FirstName string Tom
HiredOn datetime 1/1/2016
(I can't get the formatting right, sorry)
The example above just uses basic datatypes, but you can also use more complex datatypes as well. The Attribute column may have a F/K to an attributes table. Even though the attribute says "int" or "datetime", the value column stores it as a string/varchar b/c anything can be put in there. The DB can't guarantee referential integrity at this point.
Response table contains things like datetime when survey/form was taken by user something like this:
Reponses
Choices table contains the specific question & answer a user entered
Choices