> ## Documentation Index
> Fetch the complete documentation index at: https://developers.respondent.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Applying skip logic

> Using logic options with radio and checkbox questions

Both `radio` and `checkbox` questions can include skip logic, but each question utilizes a slightly different means of achieving the logic given the granularity of logic available.

<Note> For skip logic to be applied, other questions must already be created or you can pass your own UUID-format uid in the PUT Bulk endpoint </Note>

* Question IDs are returned when a screener question is created. Once created, the question `uid` can be used to determine skip logic. End of survey will create its own `uid` automatically when you set the `goToQuestionUid` as `null` in the skip logic object.

# Radio skip logic

PATCH: /v1/projects/\{projectId}/screener-questions/\{screenerQuestionId}

Radio skip logic allows for one additional layer of logic to be applied to each answer beyond Qualified (1) or Disqualified (2); the additional logic layer can designate which question a participant moves to based on the answer. For this example we'll use the sample question from basic screener question setup and apply skip logic.

<img src="https://mintcdn.com/respondentio/g4Qin-HcDj8FTCFT/images/docs/f353289-Screenshot_2023-10-12_at_10.20.29_AM.png?fit=max&auto=format&n=g4Qin-HcDj8FTCFT&q=85&s=47eb97efc4770681b14b60246827ad6a" alt="" width="854" height="828" data-path="images/docs/f353289-Screenshot_2023-10-12_at_10.20.29_AM.png" />

* The applied skip logic dictates that if East Coast or Other are selected, the participant moves to the end of the screener. If West Coast is selected, the participant moves to another question.
* This logic is applied by marking `skipLogic` = `true` and utilizing the `goToQuestionUid` field in the answer object. Setting the `goToQuestionUid` to `null` will automatically apply the End of Screener uid that we generate.

<CodeGroup>
  ```json Radio with skip logic theme={null}
  {
    "questionType": "radio",
    "text": "What is your favorite coastline in the United States?",
    "answers": [
      {
        "text": "East Coast",
        "answerValue": 2,
        "goToQuestionUid": null
      },
      {
        "text": "West Coast",
        "answerValue": 1,
        "goToQuestionUid": "DISTINCT_QUESTION_UID"
      },
      {
        "isOther": true,
        "text": "Other",
        "answerValue": 2,
        "goToQuestionUid": null
      }
    ],
    "skipLogic": true,
    "includeOtherOption": true,
    "isRequired": true
  }
  ```
</CodeGroup>

***

# Checkbox skip logic

PATCH: /v1/projects/\{projectId}/screener-questions/\{screenerQuestionId}

Checkbox skip logic allows for one or multiple layers of logic to be applied using AND/OR booleans beyond the answer level logic of May Select (1), Must Select (2), Disqualify (3). For both examples we'll use the sample question from basic screener question setup and apply skip logic.

## Single logic type

<img src="https://mintcdn.com/respondentio/g4Qin-HcDj8FTCFT/images/docs/97aa24a-Screenshot_2023-10-12_at_10.47.38_AM.png?fit=max&auto=format&n=g4Qin-HcDj8FTCFT&q=85&s=adce5b51edbff20ca3bba05bc61a0749" alt="" width="852" height="559" data-path="images/docs/97aa24a-Screenshot_2023-10-12_at_10.47.38_AM.png" />

* The applied skip logic dictates that if Dog is selected (`answerUid`) to skip to a particular question via the `goToQuestionUid` in the logic object.

<CodeGroup>
  ```json skipLogicType theme={null}
  {
    "questionType": "checkbox",
    "text": "What animals would you like to spend time with?",
    "answers": [
      {
        "text": "Cat",
        "answerValue": 1
      },
      {
        "text": "Dog",
        "answerValue": 1
      },
      {
        "text": "Giraffe",
        "answerValue": 1
      },
      {
        "text": "Pineapple",
        "answerValue": 3
      }
    ],
    "isRequired": true,
    "skipLogic": true,
    "includeOtherOption": false,
    "logic": {
      "answerUid": "DOG_ANSWER_ID",
      "goToQuestionUid": "DISTINCT_QUESTION_UID",
      "skipLogicType": {
        "text": "Selected",
        "id": "1"
      },
      "multipleAnswers": null,
      "multipleAnswersBoolType": null
    },
  }
  ```
</CodeGroup>

## Multiple answer logic

<img src="https://mintcdn.com/respondentio/g4Qin-HcDj8FTCFT/images/docs/5a9c4a2-Screenshot_2023-10-12_at_10.49.08_AM.png?fit=max&auto=format&n=g4Qin-HcDj8FTCFT&q=85&s=b69f744c58fd25018c609e73ba67760d" alt="" width="854" height="791" data-path="images/docs/5a9c4a2-Screenshot_2023-10-12_at_10.49.08_AM.png" />

* The applied logic dictates that if Dog is Selected (`answerUid`) AND Cat is Not Selected AND Giraffe is Not Selected AND Pineapple is Not Selected to skip to a particular question via the `goToQuestionUid` in the logic object.
* Either AND/OR logic can be applied for a string of multiple answers, but only one at a time can be applied via `multipleAnswersBoolType`.

<Note>
  For `skipLogicType.id` and `multipleAnswers.id`

  * Selected = 1, Not Selected = 2

  For `multipleAnswersBoolType.id`

  * AND = 1, OR = 2
</Note>

<CodeGroup>
  ```json multipleAnswers theme={null}
  {
    "questionType": "checkbox",
    "text": "What animals would you like to spend time with?",
    "answers": [
      {
        "text": "Cat",
        "answerValue": 1
      },
      {
        "text": "Dog",
        "answerValue": 1
      },
      {
        "text": "Giraffe",
        "answerValue": 1
      },
      {
        "text": "Pineapple",
        "answerValue": 3
      }
    ],
    "isRequired": true,
    "skipLogic": true,
    "includeOtherOption": false,
    "logic": {
      "answerUid": "DOG_ANSWER_ID",
      "goToQuestionUid": "DISTINCT_QUESTION_UID",
      "skipLogicType": {
        "text": "Selected",
        "id": "1"
      },
      "multipleAnswersBoolType": {
        "text": "AND",
        "id": "1"
      },
      "multipleAnswers": [
        {
          "answer": "CAT_ANSWER_ID",
          "logicType": {
            "text": "Not Selected",
            "id": "2"
          }
        },
        {
          "answer": "GIRAFFE_ANSWER_ID",
          "logicType": {
            "text": "Not Selected",
            "id": "2"
          }
        },
        {
          "answer": "PINEAPPLE_ANSWER_ID",
          "logicType": {
            "text": "Not Selected",
            "id": "2"
          }
        },
      ]
    },
  }
  ```
</CodeGroup>

***
