We’ve already scripted a basic survey. Now we need to add some logic to our survey to guide respondents through it along a pre-designated path. In this section, we'll learn about Python, the programming language used to implement logic in Decipher. We'll also encounter some common logic-based tasks within the platform.
Before going any further, we need to have a basic understanding of the Python programming language. Python is the basis for much of the Decipher platform, so even a foundational knowledge of the platform goes a long way to prepare a user for scripting surveys. In this lesson, we’ll be introduced to Python with many expressions and tasks that are common in programming Decipher surveys.
For a complete tutorial, please review the free online course linked in the reference materials below.
Now that we have foundational knowledge of Python, it’s time to put what we learned into practice. In this lesson, we’ll begin adding logic conditions to our survey. In Decipher surveys, the
cond attribute is used to apply skip logic to many survey elements. Conditions can also be applied to an entire list of answer options with
Sample sources determine how respondents get into the survey and where they are directed at survey completion. This lesson will outline the configurations we can use in the
<samplesources> tag to meet the needs of the current project, including the name, URL variables, error messages, and exit pages for our sample sources.
In this lesson, we’ll cover the basics of the Decipher quota system and build a simple
quota.xls file. This file can uploaded to the System Root directory and called through a
<quota> tag to limit and monitor our sample, ensuring that our desired specifications are met.
Continuing on from the Logic I lesson from earlier, this lesson will outline some of the more advanced applications of Python logic within Decipher. We’ll also learn about the
question object, how to build hidden and virtual questions, make our code more efficient with vector logic, and perform custom data quality checks using the
There are several methods for piping content into Decipher surveys. In this lesson, we'll learn how to set up each method, and review that method's benefits and limitations.
Advanced Shuffling I
In this lesson, we'll get an introduction to advanced shuffling in Decipher, focusing on controlling and tracking the order of answer elements. We'll also learn how the
order attribute for randomized elements can be accessed and re-assigned using a Python list, allowing us to fully control the order of answer options, or match the order across multiple questions.
Here's your next challenge! Use the questionnaire provided below to add logic to the survey you created in the Scripting Basics exercise.
Be sure to write down any questions you have and check out our live Q&A sessions for solutions and answers to your questions.
Note: Changes to the survey will be marked in RED in the questionnaire.
Note: To check your answers using the Solution Materials, download and extract the files using the link above. Once extracted, upload the
quota.xls file to a new project as a System Root File. Then upload the
survey.xml file to the same project, also as a System Root File.