How to program a non-standard or complex rotation scheme

Occasionally there will be a request to do a rotation that cannot be executed using the standard rotation commands of !Group and !Fix.

The general process is to set up a hidden question to hold the order of the rotation. Then rotate a series of !GENERATE,ADD_CODE questions into the hidden question. Then check to see if the order of those generates are showing an acceptable rotation pattern. If so, rotate your questions using the same seed. If not, then do the following:

1) Clear out the rotation seed
2) Clear out the hidden question
3) Goto back to the rotation and redo it

It is very important that you do all 3 and that you do NOT use a Reset to goback and redo the rotation as that will invoke the same seed.

HELPFUL HINTS:

It is strongly recommended that you put a display question in for debuggingpurposes before you go back so that you see what is going on. This will alsokeep you from getting into an infinite loop as you can use the display to “break” out of it.

A good way to make sure this is working is to run RDG on this block of codeand then look at the rotation order that is gotten and make sure that it isgood on all that RDG data.

This approach may not work if the actual rotations that are okay is some verysmall percentage (<5%) of possible rotations. It is not likely, but it is something to be aware of.

The example below is using a situation where you have a list of 8 brands which are optional to be rated, but you never want brands A and B to be rated NEXT to each other. The scenario might be that Brand A is your client’s brand and Brand B is their main competitor and they don’t ever want their brand to be either immediately before or after their competitors.

~CommentExample qpx to show how to set up a "complex" rotation such that the normal group and fix commands will not suffice.The example below is using a situation where you have a list of 8 brands which are optional to be rated, but you never want brands A and B to be rated NEXT to each other.  >purgesame~prep compile[complex_rotate]'Question to pick which brands to rotate, in case the brands that will'be rotated is conditional. { Which_Qs:Pick the set of brands you want to rotate belowPick at least 3 brands for testing purposes!Field,,Maximum_Responses=8>Repeat $a=01,...,08; $B=A,B,...,H$A Brand $A>EndRepeat }{!If XF(NumResponses(Which_Qs)) < 3Please pick at least 3 responses for this test !Reset,Which_Qs }'Question to just show which brands will be rotated{ BeforeRotate:You chose the following set of brands#(Which_Qs)Hit return to rotate them, but A and B will not be next to each!Display }'Hidden question to store the rotation order of the brands{ Rotated_Brands:  Hide!Field,,Maximum_Responses=8[SameAs Which_Qs] }'Now gen into the above hidden question each brand that is available{ Rotate_Seed1: !Rotate,S }>Repeat $A=01,...,08{!If Which_Qs($A)!Generate,AddCode,Rotated_Brands,$A }>EndRepeat{!End_Rotate }'Debugging quesiton to show rotate seed and rotation order.  This is strongly'recommended while you are testing as it will not only show you if your logic'is correct, but will avoid you producing an infinite loop if it is not.{ Debugging1:This is for debugging onlyShow order of gens and Rotate_SeedRotate_Seed1 -->