Have an idea?

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

Grid vs Grid number

Dear All,

I have 3 questions,

Q1 is Select question and have 4 check box
checkbox1 is Brand A
checkbox2 is Brand B
checkbox3 is Brand C
checkbox4 is Brand D

Q2 is Grid question and have 4 Rows with input box numeric got from answer have selected from Q1.
Q3 is Grid question and have 4 Rows with input box numeric got from answer have selected from Q1.

What we need:

- if Q1 select Brand A or Brand B => Q2 show Row Brand A and Brand B. As for Q3 also show Row Brand A and Brand B.
- Total Q2 (Brand A and Brand B) and Q3 (Brand A and Brand B) should bigger than 0. If Total = 0 show error message.
asked Oct 12 by Saroeun Bronze (940 points)
So Q2 and Q3 never show brands C and D?  But they show Brands A and B as long as one of those two brands is selected in Q1?

When you talk about to total, do you mean the total for each question must be non-zero or that the total across both questions must be non-zero?  Can a respondent answer zero for Q2 as long as they answer non-zero for Q3?
Answers of Q2 and Q3 as below
-Case1: if Q1 select Brand A or Brand B => Q2 show Row Brand A and Brand B. As for Q3 also show Row Brand A and Brand B.

Total Brand A and B:
- If respondent answer zero for Q2 (Brand A and B) so, one of brand in Q3 cannot zero.
- If respondent answer non-zero for Q2 (Brand A and B) so, they can answer zero for Q3.

-Case2: if Q1 select Brand C => Q2 show Row Brand C. As for Q3 also show Row Brand C.
- If respondent answer zero for Q2 (Brand C) so, one of brand in Q3 cannot zero.
- If respondent answer non-zero for Q2 (Brand C) so, they can answer zero for Q3.

-Case3: if Q1 select Brand D => Q2 show Row Brand D. As for Q3 also show Row Brand D.
- If respondent answer zero for Q2 (Brand D) so, one of brand in Q3 cannot zero.
- If respondent answer non-zero for Q2 (Brand D) so, they can answer zero for Q3.

Hope you understand and help to fix it. it's very important to me.
Seems reasonable.  So a respondent that selects A and C in Q1 would see A, B, and C in Q2 / Q3?
Yes, correct
Any one can help me? Urgently.

1 Answer

+1 vote
Code for the constructed list for Q2 and Q3:

Begin Unverified Perl
if (GETVALUE('Q1_1') || GETVALUE('Q1_2')) {
    ADD('list1', 1);
    ADD('list1', 2);
}
if (GETVALUE('Q1_3')) {
    ADD('list1', 3);
}
if (GETVALUE('Q1_4')) {
    ADD('list1', 4);
}
End Unverified


"Q1" and "list1" must be replaced with the name of the first question and its list, respectively.

Custom JavaScript verification for Q2:

var sum = 0;
for (var r = 1; r <= 4; r++) {
    sum += SSI_GetValue('Q2_r' + r + '_c1');
    sum += SSI_GetValue('Q3_r' + r + '_c1');
}
if (sum == 0) {
    strErrorMessage = 'Error.';
}


"Q2" and "Q3" must be replaced with the names of the second and third questions.
answered Oct 13 by Zachary Platinum Sawtooth Software, Inc. (63,775 points)
Thanks, Zachary.

It's still not working.
Your script is use for whole grid. But i want are below:

In case have selected from Q1:
Case 1: Total Brand A and Brand B in Q2 and Q3 should bigger than zero.
Case 2: Brand C cannot zero in both Q2 and Q3.
Case 3: Brand D cannot zero in both Q2 and Q3.
Replace the "4" in my custom JS verification with a "2."  For brand C and D, set the minimum to 1 in the grid settings.
Zachary, please let see our answers in detail for Q1,Q2,Q3.

a). Q1_1=1 or Q1_2=1 => Q2_r1_c1=0 and Q2_r2_c1=0 and Q3_r1_c1=0 and Q3_r2_c1=0 => Error Message" At least has one brand in Q2 or Q3 more than 0"

b). Q1_3=1 => Q2_r3_c1=0 and Q3_r3_c1=0 => Error Message" At least has one brand in Q2 or Q3 more than 0"

c). Q1_4=1 => Q2_r4_c1=0 and Q3_r4_c1=0 => Error Message" At least has one brand in Q2 or Q3 more than 0"

Is it possible? could you help to fix this?
Oh, you need the error to not trip unless A or B exist in Q2 and Q3.  Replace line 6 with this:

if (sum == 0 && [% ListHasParentMember(list2, 1) Or ListHasParentMember(list2, 2) %]) {


"list2" should be replaced with the name of the constructed list.
...