Previous/Next
Term logic tutorial/Selection logic tutorial
Overview
Another place logic is commonly used is in survey branching and skips. We have a variety of programming tags to help create any necessary flow and survey pathing.
Related reading and resources
The following articles can be used for reference with this training module:
- showif and skipif
- Groups
- autocode
- Auto Coding Conventions
- goto (use only as a last resort, when the above methods are unavailable or greatly prohibitive)
Applying skip logic
Open the 'Tutorial - skip logic.docx' document (linked at bottom) and review the skip-related questionnaire instructions highlighted in green. We will add the code covered below to your FLast_r8_intro survey's existing content.
Questionnaire Content | Discussion Details | Coded SPL |
[Skip A2 if option 2 (no) is selected at A1] |
In this first skip instruction, Tip! The implementation of logic doesn't always align perfectly with the instructions provided. Design the logic to provide the functionality requested, bearing in mind that the questionnaire instructions may not always be optimal. Flexibility and adaptability in the logic design are key to ensuring the survey functions as intended despite any discrepancies or ambiguities in the instructions. If you ever doubt your interpretation of the instructions, clarify with the client. Checked functions are used to evaluate closed end data:
|
Place this code on A2: showif: anyChecked($QA1,1) |
[Skip A2A if none of the options 3 (green), 6 (red), 8 (yellow) are selected at A2] |
For A2A, the instruction requests to skip the question if none of the specific options are selected in A2. The |
Place this code on A2A: showif: anyChecked($QA2,3,6,8) |
[Skip A2D if only 1 option selected at A2] |
For the skip at A2D, The
|
Place this code on A2D: showif: countChecked($QA2)>1 |
[Skip A2F if option 99 (none) is selected at A2D AND option 99 (none) is selected at A2E] |
Sometimes when creating skip logic, it's important to clarify whether a respondent selected (or did not select) a specific option at a question, regardless of whether they saw the question or not, or if it is only applicable when the respondent saw a question, and deliberately chose to select or not to select an option at a question. For example, the skip instruction for A2F could be interpreted as the client wanting the respondents to skip A2F if they did not select any colors at A2D and A2E. However, it is important to note that A2D might have been skipped. After clarifying the intention with the client, let's assume we specifically need to skip the question if A2D and A2E were both seen and "None" was selected at each question. To accomplish this, we can use the Tip! The |
Place this code on A2F: skipif: anyChecked($QA2D,99) and anyChecked($QA2E,99) |
[Ask follow up questions A3C-A3G if 1 or more entered at A3B] |
When a set of consecutive questions has the same condition(s) for showing or hiding them, it is best to place the content in a group. To build a group, add the After the last question, include the |
Place this start group: A3CtoG condition: $QA3B>0 #QA3C-QA3G here end group: A3CtoG |
[Skip B1D if None for all shapes at B1B]
|
List functions were developed to help check table logic. List functions iterate over a list in a row or column, check a condition, then return a value. There are several list functions available. Three of them are applicable to the skip instruction at B1D.
|
Place this code on B1D: showif: listCount(SHAPES; anyChecked($QB1BR[id],1..6)) > 0 OR showif: listSum(SHAPES; $QB1BR[id]) OR showif: listWhich(SHAPES; anyChecked($QB1BR[id],1..6)) |
Practice what you've learned
Practice testing the skip patterns in your survey by making the necessary selections to see a subsequent question. Then, use the back arrow in the Testmode toolbar to go back and change your answer, and intentionally skip the question.
Comments
0 comments
Please sign in to leave a comment.