Have an idea?

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

Order of follow up questions based on previous numeric entry grid

Good morning!

I don't know how easy, or possible, this is, but thought I would inquire.

I have a grid question requesting spending information, each row is a different region of the state. There is a subsequent follow up grid for each of the five regions, that is another grid asking for spending by community. These region specific follow up grid questions are all on their own page. What I would like is for the order of these follow up grids to be shown in the order of spending amount in the first grid.

So, if a respondent enters $1,000 for region 1, and $4,000 for region 2, they would only see these two follow up questions (I can acheive this with skips, not a problem) - but would like them to be asked about region 2 first, then region 1, since they spent the most in region 2.

Sound like something possible?
asked Nov 20, 2013 by Ron

2 Answers

+3 votes
Or you can use the much simpler ADDSORTED('Q1_r1') for greatest answers on first to smallest at the end, or ADDSORTED('Q1_r1', 1) for ascending order in a constructed list.
answered Nov 20, 2013 by Mike Lodder Gold (23,410 points)
I think Mike means ADDSORTED('Q1_r1',0) for greatest answers on first to smallest.
+2 votes
here is the solution.

You have to create dummy list ( Let's say NumberForRand) with the value 1 to 5. Now you need to create one constructed list (ForRand) which has parent list 'NumberForRand' and code for constructed list would be ( I am assuming your grid question with five region would be Q1)

[perl]
Begin Unverified Perl
my $sum1=VALUE('Q1_r1_c1');
my $sum2=VALUE('Q1_r2_c1');
my $sum3=VALUE('Q1_r3_c1');
my $sum4=VALUE('Q1_r4_c1');
my $sum5=VALUE('Q1_r5_c1');

my @sum_value;
my @sum_min;

$sum_value[0][0]=$sum1;
$sum_value[1][0]=$sum2;
$sum_value[2][0]=$sum3;
$sum_value[3][0]=$sum4;
$sum_value[4][0]=$sum5;


$sum_value[0][1]="1";
$sum_value[1][1]="2";
$sum_value[1][2]="3";
$sum_value[1][3]="4";
$sum_value[1][4]="5";

@sum_min=sort{$b->[0]<=>$a->[0]}@sum_value;

ADD("NumberForRand",$sum_min[0][1]);
ADD("NumberForRand",$sum_min[1][1]);
ADD("NumberForRand",$sum_min[1][2]);
ADD("NumberForRand",$sum_min[1][3]);
ADD("NumberForRand",$sum_min[1][4]);
End Unverified
[perl]

This constructed list 'ForRand' will store the value in sorted order. You need to use Block randomization for these next questions and use this new constructed list for block randomization.

Let me know if this not helps.
answered Nov 20, 2013 by Rajesh Rana Gold (23,430 points)
Thank you for the quick response! I will work on implementing this and let you know if I have success with it. Not exactly sure what is taking place in the code, so this may take a while for me to wrap my head around.

Thanks again!
...