UCL Logo
Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


When naming loops, you use the first construct that exists in the series of constructs (usually a question) that the loop describes. See Example 1 - Archivist Build and the Construct a Label page for an overall guide on labelling.

Example 1 Questionnaire: ALSPAC Study Mother's Questionnaire


When a loop relies on the answer to a previous question, such as how many times something has occurred, the logic used to generate the loop references the question.

Questionnaire layout:


Archivist Build / Constructs (alspac_96_smq):


Archivist view (alspac_96_smq):


In the above example, the loop l_qA10c references question qc_A10_b in the first part of the logic to begin the loop cycle. This runs as many times as the number that the questionnaire respondent originally states for ‘How many times?’:


  _pregnancy from 1 while (_pregnancy <= qc_A10_b) && (_pregnancy < 7)


Example 2 Questionnaire: ALSPAC You and Your Friends


This version of a loop does not rely on the value given in any previous question, but states that the questions are to be filled in up to five times:

Questionnaire layout:

Archivist view (alspac_08_yayf):

The loop l_friends describes the original questionnaire's requirement to fill in details about 5 friends or less. Therefore the loop runs while the value '_friend' is less than 6. We can see this represented in the loop logic:

     _friend from 1 while _friend < 6 

Example 3 Questionnaire: SWS Obstetric Form


Sometimes a loop is used where we cannot use a Question Grid, because the group of questions has no overarching text - an essential part of a question grid.

Questionnaire layout:

Archivist view (sws_3_clinic):