Have an idea?

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

Grid text question

hi everyone,
hope all is well.

I have a Q3 grid opened question  with 10 options, I need if respondent fill 3 or more options in q3 than show these selected options in the next question Q4(grid ranking question)

I m using constructed list with Perl and using these below mention codes in perl. but not working

any suggestion will be appreciated.

Begin Unverified Perl
if (GETVALUE("C3_r1_c1")!= ""){ADD("C3xR1",1)}
if (GETVALUE("C3_r2_c1")!= ""){ADD("C3xR1",2)}
if (GETVALUE("C3_r3_c1")!= ""){ADD("C3xR1",3)}
if (GETVALUE("C3_r4_c1")!= ""){ADD("C3xR1",4)}
if (GETVALUE("C3_r5_c1")!= ""){ADD("C3xR1",5)}
if (GETVALUE("C3_r6_c1")!= ""){ADD("C3xR1",6)}
if (GETVALUE("C3_r7_c1")!= ""){ADD("C3xR1",7)}
if (GETVALUE("C3_r8_c1")!= ""){ADD("C3xR1",8)}
if (GETVALUE("C3_r9_c1")!= ""){ADD("C3xR1",9)}
if (GETVALUE("C3_r10_c1")!= ""){ADD("C3xR1",10)}
End Unverified
asked Sep 8 by Ali Raza Bronze (930 points)

1 Answer

+1 vote
Best answer
How does this solution work for you ...
Begin Unverified Perl

 my $i=1;

 for($i=1; $i<=10; $i++)

End Unverified

It applies a more efficient loop approach and uses the "length" function.

And I believe your script is not working because the operator should be "ne" rather than "!=". Perl uses "eq" for equal and "ne" for not equal" when comparing strings in conditional script such as this example you presented.
answered Sep 8 by Paul Moon Platinum (94,725 points)
selected Sep 8 by Ali Raza
it's working :)
Did you try the loop method or just change your script?

Both will do the job.
using the loop method.
Good one. Glad to see you got it working.