If your survey requires special rules based on date, time, or day of the week, this article will introduce you to the controls you can use to make that happen.
Before You Start
You will need a Qualtrics account before you can complete this task.
The Basic Elements
Branching on date or time is not supported by any single Qualtrics control. By using a few controls together, we can build one. The building blocks we will use include:
- Survey Flow (Overview)
- Embedded Data (Setting Setting Values in the Survey Flow)
- Piped Text (Piping Date and Time)
- Branch Logic (Overview)
Combining Elements to Control Block Display
We will start putting the above together by editing a survey that contains at least two Blocks. Note that Block display is just one application of using logic in a Qualtrics survey—much of this can apply wherever you use conditional logic.
- To begin, go to Survey Flow and click Add a New Element Here, selecting Embedded Data. Give it a name (e.g. "date"), then click Set a Value Now.
- Expand the value choices and select Insert Piped Text > Date/Time > Current Date/Time.
- You will now have the option of choosing from a list of formats. Just for example, I'll select 11/29/2018 (a.k.a. mm/dd/yyyy). Your Embedded Data element should now look something like this:
- With that done, we can refer to that Embedded Data in a logic statement. In this case we'll add another element, this time choosing Branch then clicking Add a Condition as prompted. The logic we want here is to branch if our Embedded Data named "date" equals "11/29/2018", i.e. only show a Block on November 29th, 2018.
- Move the block we want to display on that date so that it's indented under the branch. The Survey Flow should now look like this:
- That's it. Using Survey Flow, Embedded Data, Piped Text, and Branching, you now have a block that will display only on the date you define.
There are several use cases for this block in surveys.
Case 1: Day of the Week
With a few small changes the instructions above can be adapted to control display on a day of the week. Let's say for example, you want to prevent participants from responding to your survey on weekends.
- Again, set Embedded Data, but this time choose the format that looks like Thursday, November 29.
- Now add a Branch, but use Contains logic rather than Equals. We will also click the green plus button to add a second condition. Join the two by Or, like you see here:
- Since we want to prevent responses on those two days, click the indented Add a New Element Here under your Branch and select End of Survey. Here's how the Survey Flow should look:
Case 2: Before or After a Date
It may be more useful to display a Block in your survey before or after some date, rather than just on the day itself. That's easily done by editing your Branch logic to use Is Greater Than or Is Less Than instead of just Equals. To be safe when doing this sort of comparison, we recommend defining the Variable Type of your Embedded Data.
- Click on Options in the Embedded Data element box
- Select Date as the type.
Here's an example of a Survey Flow that will display the Block labeled "Date Contingent" only up to (and including) November 29th, 2018.
Case 3: Time of Day
You can also use Is Greater Than or Is Less Than with time of day. In this example we will customize a greeting to read "Good Morning," "Good Afternoon," or "Good Evening." Instead of Blocks, here we will demonstrate using Display Logic in the survey question editor.
- First, define your Embedded Data field where you'll store time and select a 24-hour format, e.g 18:37. Times with AM/PM might work too, but I haven't tested that (see that I gave it the type Date since there's no Time type—it seems to work).
- Leave Survey Flow and in the Survey, create three Descriptive Text questions with the greetings.
- Add Display Logic to each by clicking the gear icon and selecting Add Display Logic. Logic here is defined just like it is in Survey Flow.
- Here's what yours may look like after adding logic to all three:
As an exercise, can you think of a way using Embedded Data, Branching, and Piped Text to tailor a greeting like this without creating three separate questions? Remember that you can pipe text from Embedded Data into survey questions.
This method lends itself to lots of applications in your survey logic. If you have any questions, email us at the address below.