Have an idea?

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

Store Others specify information in a contructed list with Perl

Hi, everyone!

I'm loosing information from the specification "Others" when I use a "for" iteration in unverified Perl, as in my example above.

Just for the record,
"marcas" is my parent list
"ListaConheceSet" is a Constructed List
"CAMPAIGNRECALL_r" comes from a grid in which the columns is "Yes" or "No" and the rows are the items from "ListaConheceSet"

The other option is the number 34 in the "marcas" list and the user have to specify by writing the name that is missing

ADD(ListaConheceSet)

Begin Unverified Perl


my $i=1;
my $tamanho=LISTLENGTH("marcas");

for($i=1; $i<=$tamanho; $i=$i+1){
    if( (LISTHASPARENTMEMBER("ListaConheceSet",$i)) && (GETVALUE("CAMPAIGNRECALL_r".$i)==1) ){
        ADD("marcas",$i);
    }else{
        REMOVE("marcas", $i);
    }
}



End Unverified
Remove(marcas,2,3)
asked Mar 1 by Renan Cintra

1 Answer

+1 vote
One way around this would be to create a second predefined list, identical to the original predefined list except for other specify list items being replaced with Sawtooth Script that returns the other specify responses.  In your case, that would be a "marcas2" list where the 34th item has been replaced with this:

[% CAMPAIGNRECALL_r34_other %]


Now point your constructed list to marcas2 instead of marcas.  If respondents select the other specify option in the grid, they'll see their other specify response when you use this constructed list.
answered Mar 1 by Zachary Platinum Sawtooth Software, Inc. (89,650 points)
...