Guide to relevance

 Form designs can include instructions to make fields (or groups of fields) appear or be skipped. This is an important part of making form designs logical, so that only the questions which are relevant to ask are visible to users. You may have heard of equivalent terms like "skip-logic" or "branching" in the context of questionnaires. In SurveyCTO, this concept is known as relevance. To explain the term, relevance, you might think of it as answering the question, "under what conditions is this field (or group of fields) relevant to ask?". 

Relevance is a property of every field in a form design and by default, every field is relevant, so you will need to create a relevance condition whenever a field might be skipped. Relevance is one of a few basic field properties which will help to make your forms logical, and increase the quality of the data you collect. Well-designed relevance will mean that users of your forms never need to think about whether the next question is the right question to ask.

Getting started

So how do you add relevance to a form? This simplest way to add relevance to a form design is with a wizard or builder tool. There are wizards and builder tools that can help you build relevance and other types of expressions at the top of the Design tab of the server console, under the Your forms and datasets heading or in the online form d designer (skip to 3:40 to see the relevance programming in this video). Here’s how to find the relevance builder in the Design tab’s Tools:

 So what are the steps in the GIF above?

  1. Under Your forms and datasets, click on Tools.
  2. Click on the Build relevance option.
  3. You’ll choose between when Any or All conditions are true, so you will need to decide on the appropriate logic (read more about this in part 2 of this guide).
  4. Add a relevance condition by:
    1. Entering the name of the field upon which the relevance is based.
    2. Choosing a type of condition (e.g. "is equal to", "is greater than").
    3. Choosing a static value, or a value stored in another field to compare to the value in the first field.
  5. You can add as many relevance conditions as you want, which will either All need to be true, or alternatively, Any one condition will need to be true (actually combinations of both logic are also possible in more advanced implementations as well).
  6. Copy the relevance expression into a form design.

This last step applies only to the Design tab’s tools. In the online form designer’s wizard (which works the same otherwise), the relevance expression will be put in the correct place. If you’re working in the spreadsheet form design template, find the relevance column on the survey sheet and copy the relevance expression over from the relevance builder into the row in the spreadsheet for the right field.

See example 3 in part 3 for a specific discussion of the expression which was built in this GIF.

Basic relevance expression examples

The relevance builder on either the Design tab or the online designer will return an expression that looks like example 1 when you follow:

Example 1 Example 2
selected(${consent}, '1') ${consent} = 1

Example 1 uses a function called selected(). Functions always look something like this, with the name of the expression, followed by opening and closing brackets. Parameters go inside the brackets. In this case, the field named "consent" should include the value 1 inside it, for the expression to evaluate as true.

Example 2 is saying that the field, "consent", must be equal to 1. So, what’s the difference from example 1? They are effectively the same in the case that "consent" is a select_one field. However, selected() works with select_multiple fields as conditions whereas this approach in example 2 does not. In a select_multiple field, more than one answer is possible, so the fact that value 1 is included can be true or false independently of the other answers to a select_multiple field. selected() can make this distinction where the expression in example 2 cannot.

The expression in example 1 is generally a better choice seeing as it works in both cases. It has the added advantage that if you were to change a select_one field into a select_multiple field, you would not need to edit any relevance conditions based on this field for them to work.

For more on selected() and any other functions, consult the help topic on using expressions in your form designs.

Expression builder tools vs. writing expression by hand

Keep in mind that you do not need to know how to write these relevance expressions yourself. You can use the tools on the Design tab or the wizard in the online form designer to build relevance conditions. With the Design tab tools, you can copy and paste relevance into the relevance parameter for fields in a spreadsheet form design. Alternatively, the online form designer’s wizard automatically places the expression in the form design.

It will be advantageous to learn how to write expressions over time because some more advanced types of relevance expressions are not possible to build using the tools or wizards. As you build relevance, you will become more familiar with what the actual expressions look like, so do take a look at the results.

This article is the first part of this feature guide. Click here to read part 2 on additional properties and considerations for relevance expressions. You can also jump to the last part by clicking here, to see working example relevance.

 

0 Comments

Article is closed for comments.