!!! Conditions
At this page you can find the documentation for conditions. Conditions are an essential part of several markups, e.g. [rules | Doc Rules], [covering lists | Doc SetCoveringKnowledge], [abstraction tables | Doc AbstractionTable] and [test cases | Doc TestCaseTable]. Conditions are used to define a logical expression on some findings and/or outcomes of a d3web diagnostic session, to tell d3web how to action under specific circumstances.
!! Simple Conditions
There is a set of simple conditions to directly test values of specific questions and solutions. The most common is the "=" operator to check for a specific value.
%%prettify
{{{
// check for a certain choice
choice-question = choice
// note: for multiple-choice questions this evaluated to "true"
// if the choice is selected, regardless is any other choice is
// additionally selected
// thus the following example might become true for those questions
mc-question = choice1 AND mc-question = choice2
// check if the value is "known" (a value of its normal range is
// answered) or if the value is "unknown" (the "unknown" choice
// of the question is selected explicitly)
any-question = known
any-question = unknown
// check the state of a solution
solution = established
solution = suggested
solution = excluded
// check a question to match a regular expression.
// the operator evaluates to "true" if the regular expression
// matches the whole answer given.
// note: the special "/" before and after the regular expression
text-question = /.*regex.*/
}}}
/%
For more details to regular expression, see e.g. [java documentation of regular expressions | http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html].
!! Numeric Conditions
Especially for numerical questions, there is a set of additional test operators.
%%prettify
{{{
// first we might use the original compare to equal,
// both operators are the same
num-question = 10
num-question == 10
// there are also checks against limits of various types
num-question <= 10
num-question >= 10
num-question < 10
num-question > 10
// finally there is a special operator to check for intervals
num-question [10 20]
}}}
/%
!! Compound Conditions
The following operators can be used to build more complex expressions from simple rule conditions:
* NOT( condition ) --- true, if the condition does not apply
* (condition1) AND (condition2) --- true, only if both conditions apply at the same time
* (condition1) OR (condition2) --- true, if at least one of the conditions do apply
!! Other Types of Formulas
For more complex formulas on any values there is also a further extension available. But be careful, this extension is non-LGPL-licensed for comercial use: [Extended Expressions: Conditions and actions | Doc Expressions]