Questionnaire content: why options not returned for mutli-select?

While exploring some new (to me) parts of the GraphQL API, I noticed something strange. Queries about single-select categorical variables return answer options. Queries about multi-select variables do not.

Single-select categorical variable:

Multi-select categorical variable. Note the empty array of options:

Is this a bug? Or do queries that target multi-select answer options need to take another form?

Note: here are further details for replication:

  • Survey Solutions version: 22.06.2 (build 32754)
  • Answer options in Designer for multi-select question queried above:

  • Entry for this questionnaire in the JSON representation of the questionnaire:
        {
          "$type": "MultyOptionsQuestion",
          "QuestionType": 3,
          "AreAnswersOrdered": false,
          "YesNoView": false,
          "Answers": [
            {
              "AnswerText": "BOUILLIR",
              "AnswerValue": "1"
            },
            {
              "AnswerText": "AJOUTER DU JAVEL / CHLORE",
              "AnswerValue": "2"
            },
            {
              "AnswerText": "FILTRER À L'AIDE D'UN TISSU",
              "AnswerValue": "3"
            },
            {
              "AnswerText": "UTILISER UN FILTRE À EAU (CÉRAMIQUE / SABLE / COMPOSITE / ETC)",
              "AnswerValue": "4"
            },
            {
              "AnswerText": "DÉSINFECTION SOLAIRE",
              "AnswerValue": "5"
            },
            {
              "AnswerText": "LAISSER REPOSER",
              "AnswerValue": "6"
            },
            {
              "AnswerText": "AUTRE (A SPECIFIER)",
              "AnswerValue": "96"
            },
            {
              "AnswerText": "NE SAIT PAS",
              "AnswerValue": "98"
            }
          ],
          "Children": [],
          "ConditionExpression": "v216==1 && IsAnswered(v216)",
          "HideIfDisabled": false,
          "Featured": false,
          "Instructions": "SELECTIONNER TOUT CE QUI S'APPLIQUE",
          "Properties": {
            "HideInstructions": false,
            "UseFormatting": false,
            "OptionsFilterExpression": ""
          },
          "PublicKey": "97076b8a-afb4-b52a-8052-6dd09e8f7443",
          "QuestionScope": 0,
          "QuestionText": "V217. D'habitude, que faites vous pour <font color=\"blue\">rendre cette eau saine pour la boisson</font>?\n<br>\nQuelque chose d'autres?",
          "StataExportCaption": "v217",
          "VariableLabel": "What do you usually do to make the water safer to drink?",
          "IsFilteredCombobox": false,
          "IsTimestamp": false,
          "ValidationConditions": [
            {
              "Expression": "self.Contains(98) ? self.Length==1 : true",
              "Message": "NE PEUT PAS CHOISIR \"NE SAIT PAS\" ET UNE AUTRE OPTION.",
              "Severity": 0
            }
          ],
          "VariableName": "v217"
        },

Note: same outcome for questions():

Yes, interesting. I tested with one of my questionnaires with the same results.
While I don’t have any need for this at the moment, I think the options for multi-select questions should definitely be returned the same way as for single-select.

Hello @klaus and @arthurshaw2002 ,

could you please check if the issue is perhaps related to the use of re-usable categories? Do the options appear if you change the setup to the opposite? If you are using re-usable categories now, enter them directly, or if not using them, define them albeit for one question only and select to be used, and then see what happens.

Hello @sergiy,

the behavior does not change when I use reusable categories instead of user-defined categories:
no options are shown.

@sergiy , to add to @klaus 's answer, from what I can tell the GraphQL API behaves as expected for single-select questions, regardless of how answer options are specified, and never behaves as expected for multi-select questions, again regardless of how answers are specified in Designer.

Single-select

For single-select questions, queries return answer options regardless of whether the answer options are User defined categories or Reusable categories.

Here’s a single-select with reusable categories in Designer:

Here’s the query result via Banana Pop Cake:

Multi-select

For multi-select, the answer options are never returned. Hence, there is either a bug with the query resolver for multi-select questions or something more needed to request multi-select question options.

User defined categories

My Designer screenshot failed to show how answer options were specified. The options for v217 are user defined categories. See below.

See original post for GraphQL results

Reusable categories

Question in Designer:

Query results in Banana Cake Pop …

… with questionnaireItems()

… with questions()

Dear Colleagues,
this issue has been ticketed in the issue tracker as

New version was released addressing this issue.