Have an idea?

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

Listing second member from another constructed list

Hi,

I'm working on constructed list that should display product name on the survey based on another constructed list where product is randomized. I have to label two products from the list but upon checking on admin module, the script below does not return value of the second member of another constructed list. It only shows the value of the first member of the list.

Begin Unverified Perl
if(VALUE("RandomizedProduct",2)==1)
{
return "ProductName1";
}
if(VALUE("RandomizedProduct",2)==2)
{
return "ProductName1";
}
if(VALUE("RandomizedProduct",2)==3)
{
return "ProductName2";
}
End Unverified

Thanks!
asked Nov 23 by anonymous
The Value function doesn't support two arguments.  Are you using it to try to get the second item from a constructed list named "RandomizedProduct"?

1 Answer

0 votes
Change the 2nd and 3rd "if" to "elsif".

I am assuming your list names are correct. Perl is case sensitive so ensure you take the spelling and case type in to account.

Also insert [%%] around the entire Perl script ...

[%Begin Unverified Perl
and
End Unverified%]
answered Nov 23 by Paul Moon Platinum (94,725 points)
...