Solved
Create choices from embedded data

I've seen some answers that get close to this question, but nothing that hits it right on.
I have ~1500 students who are taking a variety of ~500 courses (the courses have student enrollment of 6 to 120, most are in the range of 10 to 20). I would like to survey the professors of each course, presenting them with an alphabatized multiple-answer list of the students enrolled in their course, so they can select students that they have concerns about. The choices that they make in this first question will then be carried over to subsequent questions, so that I can drill-down into the reasons for the professor's concerns.
I think I see a way to do this by having a giant question with all the students listed, and then using answer display logic to show or not show them based on embedded data in the contacts (one contact for each course, one embedded data field for each student). However, that seems like a very painful way to approach the problem. Is there a better way? If not, is there a way to add the display logic programmatically?
Best answer by dsweeney
You could programmatically create a custom QSF file that has the display logic embedded in it. Loop through the students in the course to generate the embedded data fields in the contact, the answers in the big question and the display logic for the subsequent questions. Display logic in the QSF file will look something like this for each question:
{
"DisplayLogic": {
"0":{"0":{
"LogicType":"Question",
"QuestionID":"QID6",
"QuestionIsInLoop":"no",
"ChoiceLocator":"q:\\/\\/QID6\\/ChoiceTextEntryValue",
"Operator":"EqualTo",
"QuestionIDFromLocator":"QID6",
"LeftOperand":"q:\\/\\/QID6\\/ChoiceTextEntryValue",
"RightOperand":"A",
"Type":"Expression",
"Description":"<span class=\\"ConjDesc\\">If<\\/span> <span class=\\"QuestionDesc\\">Question to base your decision on.<\\/span> <span class=\\"LeftOpDesc\\">Text Response<\\/span> <span class=\\"OpDesc\\">Is Equal to<\\/span> <span class=\\"RightOpDesc\\"> A <\\/span>"},
"Type":"If"
},
"Type":"BooleanExpression",
"inPage":false
}
}
View originalLeave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.