#1 October 27, 2015 9:38am

jmason03
Member
Registered: January 9, 2014
Posts: 123

Decision Tree Callout

We have a faculty member who is asking for a decision tree style chart on one of their pages. So it would have a question appear, you choose "Yes" or "No" and then a new question appears based on your selection. Then the user would choose "Yes" or "No" again and the whole process repeats. Ideally I'd like to have this as a callout or even a field type but I'm not sure how to structure it and was wondering if you had ever built something similar? I'm not sure how to indefinitely nest either the matrix or callouts such that I can keep going deeper to add more questions. I'll need some way to associate a question to its parent so that I can have a "Go Back" button that takes them to the previous question.

If you have had any experience building something like this in the past, I would really appreciate any thoughts and ideas you might have!

Thanks

Offline

#2 October 27, 2015 10:15am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Decision Tree Callout

From a data standpoint I think I would probably make three tables. One for the overall decision trees (assuming there may be more than one at some point) that would probably just be a id, name, description. Second table for questions -- id, parent (foreign key to answers table ID), title. Third table for answers -- id, question (foreign key to questions table ID), title, position.

As far as implementing the admin side, I'd probably go with coding a custom form interface by scratch (and also groan that I was making a decision tree module). You could go with 3 forms and 3 views but it would end up not being very user friendly trying to tie the parent relationships together.

Offline

#3 October 27, 2015 2:07pm

jmason03
Member
Registered: January 9, 2014
Posts: 123

Re: Decision Tree Callout

Ok thanks for the ideas, that makes a lot of sense. I think in the interests of time I'm just going to hard code this one since it's the one and only request we have ever had. But I would like to try and implement what you talked about once I have some free time so I will definitely keep it in mind. Who knows, maybe it could even turn into an extension at some point down the road.

Thanks again!

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.