How to rotate a block of questions using !GOTO statements

The attached spec ROTATE_GRIDS.QPX​is an example ofrotating a set of more than 2000 questions. This might occur if you have something like 200 blocks, with 20 questions each, for a total of 4000 questions you are trying to rotate. You also need to use this approach if you are trying to rotate Grids.

In order to do this you need to rotate 200 goto questions that goto each of the 200 blocks, if the block has not yet been asked. Use a Hide question to determine which blocks have/have not been yet done. At the end of each block mark the hide question and then return to the top of the block. Then you can use the numitems function to count how many blocks you have gone through.

Numblocks is the number of different blocks you want to see

Maxblocks is the number of different blocks to actually do

>Def @NumBlocks 200>Def @MaxBlocks 3>PurgeSame>-PrintRepeat~Prep Compile -Specs[Rotate_Grids,,,MaxQuestionSize=20000]{ Top: !Goto }{ AlreDone: Hide!Field>Repeat $A=001,...,@NumBlocks$A>EndRepeat}{ !If Numitems(AlreDone) > @MaxBlocks!Goto, OutaHere }{ !CommentRotate @Numblocks Gotos with a condition that the block has notbeen executed yet }{ !Rotate,S }>Repeat $A=001,...,@NumBlocks;{ !If AlreDone(<>$A)!Goto, Block$a }>EndRepeat{ !EndRotate }{ !CommentHere is where all the actual blocks go.  Notice they are NOT inside ofany rotate block and that there is a Generate,Add_Code to AlreDoneand a Goto Top at the bottom of each block. }>Repeat $A=001,...,@NumBlocks{ Block$a:This is where your @NumBlocks blocks will goThis is now looking at block $A!Display }{You are now done with block $A of @NumBlocks!Display }{ !Generate,Add_Code,AlreDone,$A }{ !Goto, Top }>EndRepeat{ OutaHere:You made it thourgh @MaxBlocks times!!Display }~End

  • rotate_grids.qpx