Have an idea?

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

Add brands in one region but keep list alphabetized

I have one list for the entire country.  Brands A, B, C, D, E, F, G, H, I and J.

But brands E, H and I are only available on the West Coast.

I need to only show 7 brands in the rest of the country but keep all 10 brand codes the same for later analyses.

If I construct a list with just the 7, then add, they will not have the same codes in the data file.

If I construct a list with all 10 but remove 3 based on region, it says okay but then I get a script error when I try to test the survey.

Thanks in advance for your help.
related to an answer for: 3 extra brands in one region
asked Oct 6, 2015 by anonymous

2 Answers

0 votes
If you have one parent list (which you need for a constructed list), then your codes will always be the same in the data file regardless of the order you put them in for the constructed list.  It maintains the codes based on the parent list.  Can you post your constructed list code?  I'm sure its just a minor typo or syntax problem.  Make sure you are using the exact names of the lists or variables, Perl is case sensitive.

As an example, if your parent list was called "Brands" and the REGION you wanted to have the extra 3 brands (we'll say 1, 3, and 5) was REGION 3, you would have something like this.

ADD (Brands)
Begin Unverified Perl

if (VALUE("REGION") !=  3)
{
REMOVE ("Brands",1);
REMOVE ("Brands",3);
REMOVE ("Brands",5);
}

End Unverified
answered Oct 6, 2015 by Jay Rutherford Gold (23,095 points)
Thanks.  That did work.
0 votes
You can also use the SortByLabel SSI Script function within your constructed list to display list items in an alphabetical order.
ADD(Brands,1,10)
SortByLabel()
ADD(Brands,11)

Brands 1-10 will be added to the list and sorted alphabetically. Assume code 11 is something like Other or None or Don't know. This will always appear last.
answered Oct 7, 2015 by Paul Moon Platinum (58,715 points)
Great point Paul!  I forget to address the alphabetic part of the query.
...