Have an idea?

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

Use particular list

Is there a possility to use a particular list depending a previous question. For example, i have a question with more region. I choose one region, and the next question is asking to select a city in that region. I was thinking i can create particular list including cities in region. Thank you!
asked Oct 14, 2013 by catalin22 (410 points)

1 Answer

0 votes
You can use a simple perl script to show the attributes based on the region selected from previous question.
answered Oct 14, 2013 by Lawrence Bronze (2,100 points)
Here is the code and procedure.

Your first question will contain all the regions. The next question will contain all regions cities as members. Then create a constructed list and using that you can show the states for each region.

In this example, 'Region' is first question list. 'CityConList' based on 'City' list
Begin Unverified Perl
if (VALUE("Region")==1)
{
        ADD("CityConList",1);

}

if (VALUE("Region")==2)
{
        ADD("CityConList",2);

}

if (VALUE("Region")==3)
{
        ADD("CityConList",3);
}
End Unverified
Thank you for your answers. But my region have more than one city. Acording to your script, i can add only one city ?
You can use Lawrence's script with a minor adjustment. If the "CityConList" needs multiple codes, you can do any of the following ...

This will add cities 3-6
if (VALUE("Region")==3)
 {
         ADD("CityConList",3,6);
 } 


This will add cities 3,7,11
if (VALUE("Region")==3)
 {
         ADD("CityConList",3);
         ADD("CityConList",7);
         ADD("CityConList",11);
 } 
Thanks!
...