Useful Trick using A Loop, Piping and Answer Scales!


This how-to will show you one of the most common scripting tricks in SurveyToGo for making your survey much more efficient, robust and elegant.
Basically in this example I would show how to implement a loop that asks the same question, several times, according to selections from another question, each time for a different selection.

Let’s Do It

Let’s say for example we have the following set of questions.

First question would be:
1. Which brands have you ever heard of?    [Multi-Selection]

While its answers are derived from an answer-scale, and its last answer is an exclusive answer.

This is the second question:

2. Which of these statements suit @_@ITERNAME@_@?

Its answers would be derived from an answer scale, as following:

Second question would be within a sub chapter, as following:

*Notice that in the question itself I used @_@ITERNAME@_@ instead of ‘[NAME OF BRAND]‘ – this will replace @_@ITERNAME@_@ each iteration, with the iteration name.

*Notice that question 2 would be asked for each brand selected in question 1.

Now let’s configure our sub-chapter loop to work as expected.

In its loop tab, configure it to iterate by the brands scale, and configure it to have an entrance rule.

In this case I added the following:
Contains(QRef(1),IterationIndex) && IterationIndex <8

This will basically check each iteration before it is entered:
if question 1 contains answer(Iteration Index) AND The Iteration Index is lower than 8 (as 8 Is the ‘none of the above’ answer)

Now, this loop will iterate according to our selections from question 1, and would ask all the sentences in a loop, each time for a different brand selected in question 1.

This trick is one of the most commonly used tricks in SurveyToGo and I highly recommend understanding this – it is very useful.

Was this article helpful?
4 out of 4 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.