Have an idea?

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

Logic skip between questions with different response

I have 2 questions which i need a logic skip, the first one (A1) is a multiple question with 26 response and the second (A2) multiple with 6 response

A1- what brands do you know?
1-Brand1
2-Brand2
3-Brand3
4-Brand4
5-Brand5
6-Brand6
7-Brand7
8-Brand8
9-Brand9
10-Brand10
11-Brand11
12-Brand12
13-Brand13
14-Brand14
15-Brand15
16-Brand16
17-Brand17
18-Brand18
19-Brand19
20-Brand20
21-Brand21
22-Brand22
23-Brand23
24-Brand24
25-Brand25
26-Brand26
A2-For brands selected above what is the company offering this brand?
1-Company1
2-Company2
3-Company3
4-Company4
5-Company5
6-Company6

So what i need is when select any codes from 1 to 13  Company 1 will appear in A2 and when selected codes from 14 to 15 Company 2 appears and when selected codes from 16 to 19 Company 3 appear and from 20 to 22 company 4 appear and codes from 23 to 25 company 5 appear and code 26 company 6 appear

For example if the respondent selected in A1 brands 1,3,14, i will need in A2 to be shown only company 1 & company 2 and hide companies from 3 to 6
asked Dec 22, 2017 by anonymous

1 Answer

0 votes
Create two predefined lists, one with all brands and one with all companies.  Now create a constructed list that uses the companies list for its parent.  The constructed list needs this code:

Begin Unverified Perl
my $brandQuestion = 'A1';
my $brandList = 'brands';
my $companyList = 'companies';

for (my $i = 1; $i <= 13; $i++) {
    if (GETVALUE($brandQuestion . '_' . $i)) {
        ADD($companyList, 1);
        last;
    }
}
for (my $i = 14; $i <= 15; $i++) {
    if (GETVALUE($brandQuestion . '_' . $i)) {
        ADD($companyList, 2);
        last;
    }
}
for (my $i = 16; $i <= 19; $i++) {
    if (GETVALUE($brandQuestion . '_' . $i)) {
        ADD($companyList, 3);
        last;
    }
}
for (my $i = 20; $i <= 22; $i++) {
    if (GETVALUE($brandQuestion . '_' . $i)) {
        ADD($companyList, 4);
        last;
    }
}
for (my $i = 23; $i <= 25; $i++) {
    if (GETVALUE($brandQuestion . '_' . $i)) {
        ADD($companyList, 5);
        last;
    }
}
if (GETVALUE($brandQuestion . '_26')) {
    ADD($companyList, 6);
}
End Unverified


Line 2 should be updated with the name of the brands question.  Lines 3 and 4 should be updated with the names of the two predefined lists.

Finally, set A2 to use this constructed list.
answered Jan 4 by Zachary Platinum Sawtooth Software, Inc. (67,650 points)
...