Have an idea?

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

Error #132 – Scoring a survey

I'm trying to score a survey inside a larger survey. When I'm using the code below, I get Sawtooth Error #132. This code is in the footer of the final question in the survey.

Q1 is "How would you describe your pain? and the answer options are None, Very Mild, Mild, Moderate, Severe. None should have a score of 1, Very Mild a score of 2, and upwards until Severe has a score of 5.

 
[%Begin Unverified Perl
  
 if (VALUE("Q1")==1)
  {
   SETVALUE("Q1Score",1);
  }
elsif (VALUE("Q1")==2)
  {
   SETVALUE("Q1Score",2);
  }
  elsif (VALUE("Q1"))==3)
  {
   SETVALUE("Q1Score",3);
  }
elsif (VALUE("Q1"))==4)
  {
   SETVALUE("Q1Score",4);
  }
elsif (VALUE("Q1"))==5)
  {
   SETVALUE("Q1Score",5);
  }
  else
  {
      SETVALUE("Q1Score",0);
  }
(this would repeat here with the Question 2 values as above)
SETVALUE("TotalScore",GETVALUE("Q1Score")+GETVALUE("Q2Score"));
  
End Unverified%]
asked Apr 19 by carohut (170 points)

1 Answer

+1 vote
You have a mismatched paren on lines 11, 15, and 19.  You have two close parens where you need only one.
answered Apr 19 by Zachary Platinum Sawtooth Software, Inc. (63,900 points)
Thanks. I'm having the same problem I had earlier now though. I'll mark "Very Mild" on the questionnaire, but the Q1 score will show up as 0 instead of 2. Thoughts?
Can you email a .ssi exemplifying the problem to zachary@sawtoothsoftware.com?
...