Have an idea?

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

Hiding Attribute Levels Depending On Select Questions

Hello,
I have a series of select questions prior to the BYO section and would like to display certain price levels depending on Q1 answer (the price attribute is not displayed in the BYO section).

Here, using a radio box for Q1, if the second option is picked, only level 1 and 3 need to be kept for the ACBC exercise

-I created a constructed list with price attribute levels list as the parent list
- used the following code (there are 3 price levels):

Begin Unverified Perl
if(GETVALUE("Q1_2")==1)
{
    ADD("price",1)
    ADD("price",3)
}

End Unverified

-in the ACBC exercise settings, I linked the price attribute with that constructed list

Yet, I received a Sawtooth Error # 132 Script error message.

Am I getting it totally wrong? (it's my first conjoint)
Thank you in advance
asked Oct 27 by luclepage2017 (185 points)
reshown Oct 27 by luclepage2017

1 Answer

0 votes
Two things stand out to me.  First, the script error is being produced because of missing semicolons after the add statements.  In Perl, semicolons are required at the end of most lines of code.

In addition, "Q1_2" is valid only when using a checkbox select question.  For a non-checkbox select question, you want to see if "Q1" equals 2.

Begin Unverified Perl
if (GETVALUE("Q1") == 2)
{
    ADD("price", 1);
    ADD("price", 3);
}
End Unverified
answered Oct 27 by Zachary Platinum Sawtooth Software, Inc. (63,675 points)
...