SSI Web v8 – Loops

SSI Web v8 has the ability to loop on a defined group of questions.  A loop is defined by selecting a group of questions and associating it with a list.  The questions are asked for each item in the list.

 

For example lets say that you wanted to collect the jersey number for each person on a soccer team.  You would start by defining each player’s name in a list.  You could then create a “PlayerNumber” question.  A loop could be created and associated with the “PlayerNumber” question and the “Name” list.  The “PlayerNumber” question would then be asked for each name in the “Name” list.  The database would record the answers like this:

PlayerNumber.1
PlayerNumber.2
PlayerNumber.3
Etc.

See Video Demo

The above example demonstrates what we call “dot notation.”  Dot Notation provides a unique data field name for each instance of the loop.  The value after the dot corresponds to the list item number associated with the particular iteration of the loop.  You can nest inner loops within outer loops.  A question that is contained within multiple loops will have double or triple dot notation etc.  For example PlayerNumber.3.2 will store the data for PlayerNumber collected in the third iteration of the outer loop and the 2nd iteration of the inner loop.

Loops come with some SSI Script functions:

  • LOOPVALUE()LOOPVALUE(Loop Name)
    Returns the parent list item number for the current item in the loop. This function only works in questions established as part of a loop. The Loop Name is an optional argument that specifies, in the case that more than one loop applies (e.g. nested loops), which loop value to return.
  • LOOPLABEL(), LOOPLABEL(Loop Name)
    Returns the label for the list item for the current loop. This function only works in questions established as part of a loop. The Loop Name is an optional argument that specifies, in the case that more than one loop applies, which loop label to return.
  • LOOPITERATION(), LOOPITERATION(Loop Name)
    Returns the current iteration count of the current loop. This will correspond to the position number of the current item in the looped list. For example the first time through the loop this function will return 1, the 2nd time it will return 2 and so on. This function only works in questions established as part of a loop. The Loop Name is an optional argument that specifies, in the case that more than one loop applies, which loop iteration value to return.
  • AIELoopList(Loop Name, Question Name, Value)
    Like the AIE list function, except that it adds the list item from the loop that matches instead of the list item from the question.
  • AIGLoopList(Loop Name, Question Name, Value)
    Like the AIG list function, except that it adds the list item from the loop that matches instead of the list item from the question.
  • AILLoopList(Loop Name, Question Name, Value)
    Like the AIG list function, except that it adds the list item from the loop that matches instead of the list item from the question.
  • ANELoopList(Loop Name, Question Name, Value)
    Like the ANE list function, except that it adds the list item from the loop that matches instead of the list item from the question.

Within a loop you can also skip to the “Next Loop Iteration” or the “End of Loop”.

 

SSI Web v8 Beta Feedback