How to ask questions in response order “loop”, but store data in standard locations
The steps involved with this are similar to those in “How to “loop” through a series of questions without using a loop structure”, but are a bit more complicated.
The big advantage of this approach is the data does not need to be “derotated” on the back end because all the responses for a given “brand” are always in the same set of data locations regardless of where it was answered in the controllong question.
The steps involved with this appraoch are complicated enough that we strongly reommend that you do some tests cases and verify that you not only get the questions asked in the order you want, but that the data is also put down in the correct locations.
The basic steps to set this up are:
- At the top of the “procedure” set up a counter to keep track of which iteration you are now on.
- Then check to see if the counter is greater thanthe number of responses given and if so, skip out because you are done.
- Use a “computedgoto” (field sub-type a with skiptos to the top of each blockfor each response) to figure out which block to do this time. Use the first answer in the controlling question when the counter is 1, the second answer when the counter is 2, and so on.
- Use a >repeat to set up the block of quesitons for each “brand” that could be asked about.
- Optional; Use a hidden Variable at the bottom of the block to create extra data columns that are not used in the original design. This makes it much easier to later on add additional questions into the block.
- At the end of each block, skip back to the very top of the process.
See the attached file derotated_loop.qpx for a working example.