Have an idea?

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

use SSI_SetSelect to preselect based on a pass-inn variable

How can - for example for the question "in which country do you live" data from a pass-in variable can be used to preselect the answers of this question?

Let's say we have Country 1,2,3 - and I want automatically fill in the correct country.

Country is later used for filters and skips....so it needs to be answered.

Thak you
asked Jul 20, 2020 by anonymous
You can reference passed in variables in a survey just like you could if the question was answered.  If you created the pass-in field called country and pass in a 1/2/3, then there is no need to show a question preselected, you could write counter=1 in a skip or quota and it will work fine.

1 Answer

0 votes
Please create a constructed list for the same using below code and call the list in the question. The parent list will have 3 members - Country 1, Country 2, Country 3.

ADD(ParentListName(),c)

c needs to be changed with the pass-in field variable name.

*******************

Also, the above code that I provided can be used if I do not want to show the single select question to the respondent. The question will be skipped and the data will be stored and the skips will work normally.

If you want to show the question to the respondent and response to be pre-selected, please copy the below code in the footer of the question:

<script>
setInterval(function(){
var coun=[% c %]; /*Change c with the pass-in field variable*/
    SSI_SetSelect("[% QuestionName() %]_"+coun,true);
},100);
</script>
answered Jul 20, 2020 by Rahul Mittal Gold (11,635 points)
edited Jul 20, 2020 by Rahul Mittal
great
...