I am building a model to allow business users to build decision trees at run time.
The specific implementation would see a decision applied to a given question in a survey to decide if the question should be shown or not.
An example for discussion purposes would be:
- Q1: Please specify your gender.
(M/F) - Q2: Please specify your age.
(0-120) - Q3: Have you ever been pregnant?
(This question should only be shown if the answer to Q1=F AND the answer to Q2>9) - Q4: Have you ever had a mammogram?
(This question should only be shown if (the answer to Q1=F AND the answer to Q2>40) OR the answer to Q3=Yes
The model I have so far would see the following structure attached to each question:
The data in the stricture above should allow someone to run through the data and recreate the conditions as shown in the questions above to then allow them to either show the question, or not based on the aswers to the previous questions.
What I have so far feels a bit messy though and I was wondering if their is an established pattern that anyone can think of that will accomplish this. Any other feedback would also be useful.
I hope my questions makes sense.
Update (28 Mar 2017):
@Avitus: I don't agree with your thoughts (Please correct me if I'm wrong). EValuation does only compare two criteria at a time, but the TargetEvalID allows you to compare a question with a previous group. I.E. In the example I gave I am comparing ((Q1 AND Q2)OR Q3). To achieve what you're saying I could just do nested questions. If I wanted to do A and B and C I would do (A and B) and C.
Does that make sense?
Update (29 Mar 2017)
I've made one change to the model to allow for groups to be compared to other groups.
I.E. (A AND B) OR (C AND D)