getCount: selection frequency of answers

Difficulty level: Difficult

What does the functionality do?

Suppose you have defined multiple answer options for a single response question. In a survey study, you want to know exactly how often these answer options were selected by the various participants. In such a situation, you can use the getCount functionality.

Use case and how to set it up?

After you have specified the survey question, you can define the corresponding answer options. In the image above, for example, it involves the country where a participant last spent his/her holiday. The countries entered as answer options, for example, are France, Spain, Italy and Germany. All these countries are automatically assigned a unique value, which can be adjusted if necessary, e.g. France (value: 1), Spain (value: 2), Italy (value: 3) and Germany (value: 4).

NoteThe Force response setting must be ticked, if you want participants to respond to this question.

After this, you can include a separate value assignment for each answer option (here: country), e.g.

Answer optionVariableData typeIs equal to the following term:
FranceFranceInteger numbergetCount(q1,1)
SpainSpainInteger numbergetCount(q1,2)
ItalyItalyInteger numbergetCount(q1,3)
GermanyGermanyInteger numbergetCount(q1,4)

In the Is equal to the following term: box, you can therefore include a similar formula for each answer option. In the Execute setting, select the option Every time the participant passes this point.

The formula for each of these value assignments can be interpreted as follows: getCount(q1,1) > when the first survey participant has selected the France answer option (value 1) from question q1, the counter for the variable France will increase from 0 to 1. Each time a participant selects the France answer option, this counter will be incremented by 1 again. Should the France answer option be selected 30 times, then the counter will be at 30.

If you want to show a participant an overview of the selection frequency of all answer options, you can include a text block in the survey after the four value assignments. In this text block, you can include text such as The number of times a country was chosen as a destination where a participant spent his/her last holiday AND four custom variable placeholders. Any such placeholder is always assigned the prefix custom, e.g. {{custom.France}}.

In order to include a custom placeholder in a text box, proceed as follows:

  • Click the link labelled Rich text editor at the top right of the text box to go to the RTE window.
  • Click the Placeholder icon (1).
  • Click the triangle in front of Custom Variables (2) at the bottom of the RTE window so that all custom variables created for the corresponding survey are displayed, see the Placeholder column on the right.
  • Specify the position in the text box (3) where a custom variable placeholder should be inserted.
  • Click the link {{custom.France}} (4) for this placeholder to be included at the indicated position in the text box.
  • Repeat the two previous steps for the other three custom placeholders.
  • Click the Save changes button (5) in the Rich text editor. The custom variable placeholders will be included in the survey.

For more information, please refer to the Rich Text Editor (RTE) article.

When downloading the raw data, you will see that the answers provided by the participants, i.e. the unique values assigned to them, are shown in the q1 column AND the state of the counters in the custom variables columns (France, Spain, Italy, Germany).

Updated on June 19, 2023

Was this article helpful?

Related Articles

Need Support?
Please login to your Survalyzer account and use the "Create Support Request" form.
Login to Survalyzer