In this article
A loop is a type of container where any questions and other survey elements placed inside the loop will be repeated for a number of iterations.
You may want respondents to provide feedback on a number of items - a list of products perhaps, where you wish to present the same questions for each item. Instead of copying the questions for each item you can put one set of the questions inside a Loop node. When the respondent reaches this node, the survey will ask the same questions for each item, and will move on to the next question once it has received answers for each item.
If the respondent has previously selected the items from a longer list, then you can base the loop on the items the respondent has selected.
For example, assume you wish to repeat a block of questions for a list of car makes. Instead of defining the same block of questions for each car, only replacing the car name for each block, you can simply create a loop that iterates through the list of cars asking the same question(s) for each - .
You can also use nested loops (loops within loops).
Note: If the survey uses the Optimized database format (go to Optimized Database Format for more information), then you will be able to use the loops as answer lists in other questions.
Figure 1 - Example of a Loop object
Loop Details
The various fields and columns in the loop-details page are:
- Loop ID - a unique ID of the loop within the survey. The maximum length is 50 characters and it can contain only alphanumeric characters.
- Add - adds a row to the answer list for the loop.
- Add Predefined - enables you to add a predefined list to the loop answer list.
- Set Row Height - opens a pop-up window in which you can define the height of the answer cell in edit mode.
- Click on the View button to add and remove columns from the table.
- Language columns - the first columns in the list contain the text of the loop-iteration. There is one column for each active language (go to Languages Codes for more information).
- Code - defines the code of the iteration. If a code is not supplied, the code will be equal to the position in the list, starting from 1. Codes can only contain alphanumeric characters, and underscore (_), with no white space. The default maximum length is 32 characters (can be increased to max. 50). Illegal characters will cause the database compilation to abort (go to APPENDIX A: LIMITS for more information).
- Style - select a style in which the various items in the list are to be presented. The styles available are those contained in the Themes and Skins > HTML Styles folder in the Survey Tree toolbox (go to About HTML Styles for more information).
- KeepPos - set this property to “yes” if you want an item to keep its position when randomizing or rotating the list of iterations.
Masking - if you want to filter the list of iterations, use this field to create a JScript-expression resulting in a set of codes to include or exclude (go to Code and Scale Masks for more information).
Loop Properties
Loops have a Properties page - .
Figure 2 - The Properties list for the Optimized Database format
The properties available for loops are as follows:
- Exclude Translation – Allows you to exclude certain questions from the translator interface (go to About Translator for more information). This property gives you the possibility to hide nodes that are used for internal programming purposes from the translators in Forsta Plus Translator.
- Answers - [Only for loops in Optimized Database format] select answers for the loop:
- Normal Answer List (default) - a normal list of answers is used.
- Table Lookup - Table Lookup answers are used (go to Hierarchy Lookup for more information).
- Auto Increment - an answer list is not used. Instead of predefined answers, it automatically increments the loop identifier until a script function is called to terminate the loop (go to Auto Increment Loops for more information).
- Answer list display order - this property controls the order that the list items appear in:
- In order – in the order that they appear in the list.
- Randomized – in pseudo-random order (go to Randomization for more information).
- Rotated – the list is shifted and rotated by one position for each new response.
- Flipped - will alternate between displaying the list top-bottom or bottom-top for different respondents.
- Alphabetically sorted - will sort the list alphabetically based on the labels (in the current language).
Any answer alternatives that have the KeepPos property set to Yes will keep their original position in the list.
- Field width - the number of characters assigned to the iteration code in the database and when exporting to fixed width ASCII files.
- Deleted - when you delete a loop from the routing, it is not permanently deleted, but the “deleted”-flag is set. If you turn on Show deleted nodes, you can undelete the object by unchecking this flag.