Have an idea?

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

SSI Script within Perl Script

I have the below script where I want to return options selected from dropdown box. If respondents selects other specify then need to show the text entered. It is not working. What is the mistake?

[% begin unverified perl
if(VALUE("Q5A1_r1_c1") le 28) {return [%Label(Q5A1_r1_c1)%];}
if(VALUE("Q5A1_r1_c1") eq 29) {return [%Q5A1_r1_c2%];}
end unverified %]
asked Oct 25, 2013 by anonymous
fixed the code

[% Begin Unverified Perl

if (VALUE("Q5A1_r1_c1") le 28)
{LABEL("Q5A1_r1_c1")}
else
{VALUE("Q5A1_r1_c2")}

End Unverified%]

2 Answers

+3 votes
 
Best answer
Please change this to

[% begin unverified perl
if(VALUE("Q5A1_r1_c1") le 28) {return LABEL('Q5A1_r1_c1');}
if(VALUE("Q5A1_r1_c1") eq 29) {return VALUE('Q5A1_r1_c2');}
end unverified %]
answered Oct 25, 2013 by Rajesh Rana Gold (23,430 points)
selected Dec 15, 2013 by Rajesh Rana
+2 votes
[%...%] will not work within unverified perl.

Use directly LABEL in caps after return.
answered Oct 25, 2013 by Saurabh Aggarwal Gold (27,730 points)
Perl is case sensitive so your variables and functions you use must follow the syntax rules. Sawtooth HELP clearly describes how all functions in Perl should be written (search for Perl)). Write your variables exactly how you defined them in your survey.
...