Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Randomize CBC Questions & Record Question Order

I have a CBC study with 12 versions and 8 screens, the design for which was provided by the client. I need to keep the versions intact, but randomize the order in which the screens are shows, as well as record the question order in the data. Can anybody please advise a best way to do this?

Thank you!
asked Sep 8, 2017 by LisaVogl Bronze (530 points)

1 Answer

0 votes
Begin by adding one pass-in field for each CBC task.  Each one should have the same base name but with a unique number at the end, like "cbc1", "cbc2", et cetera.  Then put this code in your CBC:

[% Begin Unverified Perl
my $tasks = 8;
my $base = 'cbc';

my $qname = QUESTIONNAME();
for (my $i = 1; $i <= $tasks; $i++) {
    my $pif = $base . $i;
    my $val = GETVALUE($pif);
    if ($val eq $qname) {
        last;
    }
    if ($val eq '') {
        SETVALUE($pif, $qname);
        last;
    }
}
End Unverified %]


Line 2 should be updated with the number of CBC tasks.  Line 3 should be updated with the base name of the pass-in fields.
answered Sep 11, 2017 by Zachary Platinum Sawtooth Software, Inc. (104,800 points)
...