questionForData function

QuestionDef? questionForData(
  1. DataType dataType,
  2. FormDef? form,
  3. TreeReference ref
)

The select question bound to ref, needed to attach choices.

Port of XFormParser.ghettoGetQuestionDef.

Implementation

QuestionDef? questionForData(
  DataType dataType,
  FormDef? form,
  TreeReference ref,
) =>
    (dataType == DataType.choice || dataType == DataType.multipleItems) &&
        form != null
    ? FormDef.findQuestionByRef(ref, form)
    : null;