Expand on enumerated field data

Some fields are not simply text, or date, or ID. Some fields have enumerated alternative sets. There are 2 arguments involved in these types of fields: the value (or sequence number), and the label (the text associated with the sequence number).

By default, using the fieldData argument will return the sequence number.

Sample query - Pull the sequence number of an enumerated field

query seqNumber {
  feedback (orderBy: {fieldId: "a_surveyid", direction: ASC} first: 3) {
    nodes {
      devCycle: fieldData(fieldId: "e_bp_development_cycle_alt") {
        values
      }
    }
  }
}

Sample response

{
  "data": {
    "feedback": {
      "nodes": [
        {
          "devCycle": {
            "values": [
              "2"
            ]
          }
        },
        {
          "devCycle": {
            "values": [
              "2"
            ]
          }
        },
        {
          "devCycle": {
            "values": [
              "2"
            ]
          }
        }
      ]
    }
  },
  "errors": null,
  "_links": null,
  "_allowed": [
    "POST",
    "GET"
  ]
}

To bring the name of the alternative set, use the labels argument.

Sample query - Bring the sequence number and name of an enumerated field

query altSetName {
  feedback (orderBy: {fieldId: "a_surveyid", direction: ASC} first: 3) {
    nodes {
      devCycle: fieldData(fieldId: "e_bp_development_cycle_alt") {
        values
        labels
      }
    }
  }
}

Sample response

 {
  "data": {
    "feedback": {
      "nodes": [
        {
          "devCycle": {
            "values": [
              "2"
            ],
            "labels": [
              "QA"
            ]
          }
        },
        {
          "devCycle": {
            "values": [
              "2"
            ],
            "labels": [
              "QA"
            ]
          }
        },
        {
          "devCycle": {
            "values": [
              "2"
            ],
            "labels": [
              "QA"
            ]
          }
        }
      ]
    }
  },
  "errors": null,
  "_links": null,
  "_allowed": [
    "POST",
    "GET"
  ]
}

Additional examples

The labels argument pulls the value of field e_bp_development_cycle_alt. The field argument is used to ask for field metadata as part of the data node.

Sample query

query altSetExample{
    feedback (orderBy: {fieldId: "a_surveyid", direction: ASC} first: 2) {
        nodes {
            id
            fieldData(
                fieldId: "e_bp_development_cycle_alt"
            ) {
                field {
                    id
                    name
                    dataType
                    multivalued
                    filterable
                }
                labels
                values
            }
        }
    }
}

Sample response

{
  "data": {
    "feedback": {
      "nodes": [
        {
          "id": "3725",
          "fieldData": {
            "field": {
              "id": "e_bp_development_cycle_alt",
              "name": "Development Cycle",
              "dataType": "ENUM",
              "multivalued": false,
              "filterable": true
            },
            "labels": [
              "QA"
            ],
            "values": [
              "2"
            ]
          }
        },
        {
          "id": "3726",
          "fieldData": {
            "field": {
              "id": "e_bp_development_cycle_alt",
              "name": "Development Cycle",
              "dataType": "ENUM",
              "multivalued": false,
              "filterable": true
            },
            "labels": [
              "QA"
            ],
            "values": [
              "2"
            ]
          }
        }
      ]
    }
  },
  "errors": null,
  "_links": null,
  "_allowed": [
    "POST",
    "GET"
  ]
}