Have an idea?

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

Using perl constructed list to trigger skip

Good evening,

I have a situation where we have 30 pages, each page has a predefined conjoint set, and the 30 pages are randomized. I want the respondent to answer 9 of these questions and then be skipped out of the block of 30. To do so I imagined I could simply write a PERL script list build that would add a list item every time the conjoint set was greater than 0. Then, using ListLength=9 to trigger the skip logic (the skip is in a html/text filler question along with each conjoint set).

Here is the perl:
Begin Unverified Perl  
 
 if(VALUE("CBCRAN1") > 0)   
 {   
    ADD("Count",1);  
 }   
 if(VALUE("CBCRAN2") > 0)   
 {   
    ADD("Count",2);  
 }
 if(VALUE("CBCRAN3") > 0)   
 {   
    ADD("Count",3);  
 }

......... and so on until  30. CBCRANx is the conjoint set, which shows up in the data as a 1 or a 2 depending on which column is select and Count is simply a list of the numbers 1 through 30 - so that the perl is adding different list items to a list named VersionSkipOut.

Then in the html/text page I have ListLength(VersionSkipOut)=9 skip out of the conjoint block of questions.

Maybe I missing something about when and how a list is created? Issue with my perl?

Any help or insight would be greatly appreciated! Thank you!
asked Mar 17, 2014 by RonH (195 points)

1 Answer

0 votes
Once a constructed list is evaluated, that's it. The list does not recalculate later on. I think that is your problem?
answered Mar 17, 2014 by Paul Moon Platinum (58,815 points)
I'm not a conjoint programmer but if I had 30 randomly selected pages in a standard Sawtooth survey and only wanted 9 shown, I would skip out when the LOOPINTERATION hit 10.
Hi Paul,

Thank you for the speedy feedback. The single evaluation definitely would explain why it is not working. That being said, I am not really sure how to skip them out of the block of 30.  As best I can tell, LOOPITERATION is a function in V8, which is newer than my version. It may be time to upgrade, if I cannot figure out another way to skip out after 9.

Thanks again for the info!
You can pop codes 1-30 into a parent list (call it SelectorList). Setup a constructed list (call it SelectorConList) as follows ...

ADD(SelectorList)
Randomize()
ListMax(9)


Use ListHasParentMember(SelectorConList,1) for example for your skip.
...