Have an idea?

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

Setting the value of a single response question

Gentlemen, good morning.

Currently using Sawtooth Software, version 8.4.8.

Here's the following situation:
In one of our multiple choice questions, which leads to the creation of a list for a single respose question, there is the possibility of checking only one option (apart from "None of the above"). In case the respondent checks only one option, I would like to set this column's index as the value in the single response question.
Where do I place the commands, given the fact that the single response question is a quota?

I have tried something like this:

1) Create a Pass-in field named "First Choice";
2) Try the commands below:
Begin Unverified Perl
    my $brand = 0;
    for ($i = 1; $i <= LISTLENGTH("marcasV2"); $i++)
        if (LISTHASPARENTMEMBER("List",$i) && NUMCHECKED("Multiple") == 1 && GETVALUE("Multiple_".$i)==1)
        {$brand = $i;}
        else {$brand = 0;}
End Unverified

Thanks a lot for your time.


asked Sep 17, 2019 by Mauricio Belleza Bronze (860 points)
Your code looks like it ought to run.  Does it not?

Assuming that it is working, what behavior do you need to change?  I assume if you were to replace "FirstChoice" with the name of your quota question, I would think it would save to the database correctly.  Perhaps you also want additional code to skip the quota question from being seen by the respondent?

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.