The Decision Matrix widget opens when a user edits a decision matrix.
Decision Matrix is effectively a table which has rows and subrows, columns and subcolumns. Each row in the matrix (excluding header information) represents a single question; each column represents a potential outcome.
Each question can have multiple subrows to represent potential answers to the question; each outcome can have multiple subcolumns which contain a checkbox for each answer; the checkboxes are used to specify which combinations of answers lead to a given outcome. The answer type values supported in the Decision Matrix are booleans (true/false), code tables, numerals, and strings.
Contradictions can also be added to a Decision Matrix which indicate answers in contradiction to each other. For example, the question, "Can you walk" is parallel to a question, "Can you run". If a person answers no to the first question, then it should not be possible to answer yes to the second question; it would be a contradiction for a person to state that he or she can run but cannot walk.
In order to display the initial view of a Decision Matrix, an XML string describing its contents will be returned from the server code. A user can edit the Decision Matrix (add questions, answers, outcomes, etc.), and save all of these modifications at the same time. A string with the same XML structure will be passed into the server code, thus storing the updates. The following is a sample XML string which can be passed into the server code (including support for multiple locales):
<DECISION_MATRIX_XML ID="M1">
<QUESTIONS>
<QUESTION QUESTION_ID="Q1" IS_NEW="false">
<ANSWER ANSWER_ID="1" VALUE="C1" PRIORITY="1" />
<ANSWER ANSWER_ID="2" VALUE="C2" PRIORITY="2" />
<ANSWER ANSWER_ID="3" VALUE="C3" PRIORITY="3" />
</QUESTION>
<QUESTION QUESTION_ID="Q3" IS_NEW="false">
<ANSWER ANSWER_ID="1" VALUE="C1" PRIORITY="1" />
<ANSWER ANSWER_ID="2" VALUE="C2" PRIORITY="2" />
<ANSWER ANSWER_ID="3" VALUE="C3" PRIORITY="3" />
</QUESTION>
<QUESTION QUESTION_ID="Q5" IS_NEW="false">
<ANSWER ANSWER_ID="1" VALUE="A" PRIORITY="1" />
<ANSWER ANSWER_ID="2" VALUE="B" PRIORITY="2" />
<ANSWER ANSWER_ID="3" VALUE="C" PRIORITY="3" />
</QUESTION>
<QUESTION QUESTION_ID="Q6" IS_NEW="true">
<ANSWER ANSWER_ID="1" VALUE="Yes" PRIORITY="1" />
<ANSWER ANSWER_ID="2" VALUE="No" PRIORITY="2" />
</QUESTION>
<QUESTION QUESTION_ID="Q7" IS_NEW="true">
<ANSWER ANSWER_ID="1" PRIORITY="1" MIN="1" MAX="9" />
<ANSWER ANSWER_ID="2" VALUE="10" PRIORITY="2" />
<ANSWER ANSWER_ID="3" PRIORITY="3" MIN="11" />
</QUESTION>
</QUESTIONS>
<CONTRADICTIONS>
<COMBINATION COMBINATION_ID="C1">
<MESSAGE LOCALE="en_US" TEXT="A person undergoing
third level treatment for arthritis cannot
walk for 3 KMs"/>
<MESSAGE LOCALE="fr" TEXT="Une personne subissant
le troisième traitement égal pour l'arthrite ne
peut pas marcher pour 3 KM"/>
<SELECTION QUESTION_ID="Q1" ANSWER_ID="1" />
<SELECTION QUESTION_ID="Q7" ANSWER_ID="1" />
</COMBINATION>
<COMBINATION COMBINATION_ID="C2">
<MESSAGE LOCALE="en_US" TEXT="A person undergoing
third level treatment for arthritis cannot walk
without support"/>
<MESSAGE LOCALE="fr" TEXT="Une personne subissant
le troisième traitement égal pour l'arthrite ne
peut pas marcher sans le soutien"/>
<SELECTION QUESTION_ID="Q1" ANSWER_ID="1" />
<SELECTION QUESTION_ID="Q6" ANSWER_ID="2" />
<SELECTION QUESTION_ID="Q7" ANSWER_ID="1" />
</COMBINATION>
</CONTRADICTIONS>
<OUTCOMES>
<OUTCOME OUTCOME_ID="O1" IS_NEW="false">
<COMBINATION COMBINATION_ID="C3">
<SELECTION QUESTION_ID="Q1" ANSWER_ID="3" />
<SELECTION QUESTION_ID="Q3" ANSWER_ID="2" />
<SELECTION QUESTION_ID="Q6" ANSWER_ID="1" />
</COMBINATION>
</OUTCOME>
<OUTCOME OUTCOME_ID="O2" IS_NEW="true">
<COMBINATION COMBINATION_ID="">
<SELECTION QUESTION_ID="Q3" ANSWER_ID="3" />
<SELECTION QUESTION_ID="Q5" ANSWER_ID="2" />
<SELECTION QUESTION_ID="Q6" ANSWER_ID="2" />
<SELECTION QUESTION_ID="Q7" ANSWER_ID="2" />
</COMBINATION>
</OUTCOME>
</OUTCOMES>
<DELETED_ITEMS>
<QUESTION QUESTION_ID="Q2"/>
<QUESTION QUESTION_ID="Q4"/>
<OUTCOME OUTCOME_ID="O3"/>
</DELETED_ITEMS>
</DECISION_MATRIX_XML>