Variable relevance

Sometimes, say when trying to understand why a question has or has not been enabled in the questionnaire, it is useful to inspect what Author has determined as the variable's relevance within a particular template. To do this you should find the question in the Dictionary Editor and go to the Usage tab. This will display the relevancy of that variable.
Checking relevance within Usage tab.
Alternatively, you may select the text in the template and click the
Relevance
button on the ribbon.
Relevance icon.
This will display the relevancy of that variable.
Relevancy window of selected variable.
A question may have been used in multiple places throughout a template. The usage context is a combination of those occurrences. If any of the occurrences are within a repeat span then the usage context comprises a repeat context and a logic context, otherwise it is just a logic context. Occurrences in different repeat contexts cannot be combined, and in this instance the usage context will comprise multiple repeat contexts with their corresponding logic contexts.
The usage context of a questionnaire group is the combination of the usage contexts of all the questions in that group. Similarly, the usage context of a questionnaire page is a combination of the usage contexts of all the groups on that page.

What occurrences of a question variable contribute toward that question’s relevance?

Occurrences that contribute to Relevance
Any use of a question variable, either directly or indirectly, in the definition of a field or a span will normally contribute to its relevance. “Directly” means actually mentioned in the field or span definition, and “indirectly” means referred to via a computation variable.
The exceptions to this basic rule are:
  1. Any occurrence within a footnote or endnote.
  2. Any occurrence explicitly excluded by the
    Cloaked
    function.
  3. Any occurrence inside a quantifier function, namely
    Collect, Every
    and
    Exists
    .
  4. Any occurrence in the first argument to the hash (#) operator.
  5. Any occurrence inside the meta-functions
    Relevance, Known, KnownTrue, CollectValues, Definite, Answered, Sure, Committed, Deferred, DataType, Attribute, PrescribedSelections, OtherSelections, SelectionOptions, ExpressionText, Simplify, Other and OnlyOther
    .
  6. Any occurrence in the span
    Style
    or
    Value expressions
    .
  7. Occurrences in the With expressions of
    Include
    and
    Attach
    template fields (see template hierarchy) do not just use the context of the field, but also factor in their usage within the sub-template itself.
Occurrences that do not contribute to Relevance
Occurrences in the template name active text do not contribute.
Occurrences in dictionary objects other than questions do not contribute, for example variables in warnings, dynamic lookup tables, or even in computations that are not used (directly or indirectly) by a field or span
Missing Relevance
Finally, once the relevance for all variables across an entire suite of templates has been established under the preceding rules, references from other variables are taken into account. References from expression properties, say for the default value or for the dynamic selections, are always considered, but references from Active Text properties are only considered if the referenced variable was not relevant under the preceding rules. Its relevance is the combined relevance of all variables that reference it (directly or indirectly) from their properties, accounting for their context within that expression, for example if it was nested inside an "if" statement.
Special Situations
It is tempting to think of the special Boolean functions
OnlyOnInput
and
OnlyOnOutput
as masking occurrences from contributing to relevance, but this is not strictly true. Any occurrence within the scope of one of these conditions does contribute to relevance but includes that condition as part of its relevance. At run-time
OnlyOnInput
returns false when the wording of a generated document is being prepared and true otherwise; conversely
OnlyOnOutput
returns true if a document is being generated and false otherwise. This may well affect whether a question appears in the questionnaire.

Related content