The <cond> subtag specifies a condition that governs the evaluation of declarations in its parent <entity> or <relationship> tag. The evaluation semantics of the tag follow the semantics for the <attr> tag: a non-empty string as a result indicates that the condition is true, an empty string or a failure indicates that the condition is false. Multiple <cond> tags can be specified, creating a fallback chain with <attr>-style fallback semantics.
Notice in the example given in the section on decisions that the parser creates a decision entity even when the name of the target resolves to a single value. Use a <cond> subtag in the relationship definition to avoid that:
<rel name='ReadsDataportDecision'> <cond if-multi='%x' value='%_yes'/> <target type='DECISION'> <attr name='HCID' value='%_hcid'/> <attr name='DecisionType' value='DATAPORT'/> <attr name='AKA' value='%_pgmname.ReadsDataport.%_varname1'/> <attr name='AKA' value='%_pgmname.ReadsDataport.'/> <attr name='VariableName' value='%_varname1'/> <attr name='Completed' if-closed='%x' value='True'/> <rel name='ResolvesToDATAPORT'> <target type='DATAPORT' name='%_pgmname.%x'/> </rel> </target> </rel> <rel name='ReadsDataport'> <cond if-single='%x' value='%_yes'/> <target type='DATAPORT' name='%_pgmname.%x'/> </rel>
This repository definition produces the same result as the example in the section on decisions, except that no decision is created when the name of the target resolves to a single value.
_yes and _no are predefined variables that evaluate, respectively, to a non-empty and empty string for true and false, respectively. The if-single attribute means that the <cond> tag should be interpreted only if the specified variable has a single defined value. The if-multi attribute means that the <cond> tag should be interpreted if the variable has multiple values, none, or can be undefined. The if-closed attribute blocks the <cond> tag if the variable has an undefined value.
Conditions have join set to an empty string by default, resulting in a _yes outcome if any combination of values of the variables used in switches within causes it to evaluate to _yes. If a particular condition definition should fail when some of the values evaluate to _no and others to _yes, use a yes-only='yes' attribute specification. That causes join to be unset, and the condition to give a non-fail outcome only when all values evaluate to _yes.
In a relationship definition, <cond> determines whether the relationship is generated. For a decision relationship, it also determines whether the decision entity should be generated.
In an entity definition, <cond> governs all attribute and subrelationship definitions in the tag, and the creation of the entity in case of a standalone entity. For an entity specified in a <target> or <source> tag, instantiation of the relationship automatically spawns the corresponding entity, meaning that a false condition on the source or target of a relationship does not prevent creation of corresponding entities.