Have an idea?

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

storing value in hidden variables from single and multiple select questions for each brand

how i can store value from single and multiple select questions for specific brands in a hidden variable that I can use later in a constructed list.

Need to store value of TOM, Spont, and Aided awareness for each brand in the list in a dummy, hidden variable that I can use later in the constructed list for Image attributes grid type question.
asked Aug 26, 2014 by Rashid (230 points)
Hidden questions are one method where you can store variables.

In V8, you can now use SetValue to set a value and GetValue to retrieve the value for later use. You must define your variable in the Pass-In-Fields within your Start question.

You can use these two functions in SSI Script and Perl as you would do any other functions within Sawtooth.

This variable is also available to export as you would do with a hidden question.

1 Answer

0 votes
I am not sure why do you want to save values in hidden question first. I am pretty sure, it is possible using those variable directly in constructed list.

Anyway for your help, here is the method.

You need to create free format question, let's say question name is "Dummy". You need to define variable name in variable/question html tab. Let's say, we have created Dummy_r1, Dummy_r2.

Now to save value of any quesiton( I am assuming Q1 as multiselect). Here is the code, you need to write in html section.

<input name="Dummy_r1" id="Dummy_r1" type="hidden" value="[%Begin Unverified Perl
if(VALUE('Q1_1')==1)
{
    return '1';
}
else
{
    return '0';
}
End Unverified


Let me know if it is not clear to you.
answered Aug 26, 2014 by Rajesh Rana Gold (23,530 points)
...