Have an idea?

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

How do I create a constructed list with more items than the parent list contains

I have 2 questions (Q1,Q2):

Q1 - Do you know following Brands?
Parent List "Brands":
- Brand1
...
- Brand5

Answers:
- Yes
- No

Q2 - In your opinion, which brands from the list fit well to the following characteristics?

This is grid questions with the characteristics in the rows.
In the columns - I need to show all the brands which respondent knows in the question Q1 (AIE(Q1,1)) and I need 1 additional column for the answer "None of them".

Non-ideal solution is to add "None of them" into the parent list and create constructed list without this item for the question Q1.
Than we can create list for the Q2 by following way:
AIE(Q1,1)
ADD(Brands,6)

But this solution finally generates useless and empty variable Q1_r6.
Does exist any better solution?
asked Jul 25 by vs.sedlo

1 Answer

0 votes
You can use the method you mentioned and add item 6 to the Brands parent list. Then you would have to create a constructed list at Q1 and not display item 6. Item 6 would always be blank at Q1 as you indicated.

Another approach is to create a new parent list at Q2 and make it the same parent list as Brands but add Item 6 to it.

We then create a constructed list using some Perl script as follows ...
Begin Unverified Perl

 my $i=1;

 for($i=1; $i<=5; $i++)
  {
   if (VALUE("Q1_r".$i)==1)
    {  
     ADD("Q2List",$i);
    }  
  }

 ADD("Q2List",6);

End Unverified

This script assumes Q1 is a row direction grid question. If Q1 is a select question, simply change the following ...

if (VALUE("Q1_r".$i)==1)
TO
if (VALUE("Q1")==$i)

I have also assumed your parent list at Q2 is named "Q2List". Change this to your list name.

And if you want to randomise the Q1 items at Q2, add in this command above the last ADD command ...

RANDOMIZE():
answered Jul 26 by Paul Moon Platinum (74,305 points)
Nice approach Paul!  Got me thinking you could also create a list for Q1 with the AIE command.  Then create a second parent list with item 6 added as you indicated.  Then when creating the constructed list as you did for Q2, you could use the MIRROR command and mirror the list created from Q1 and then use ADD to put item 6 on it.  Same concept you mentioned but another alternative for list construction.  I've grown to love the mirror command and use it a bit.
Jay, I was writing this solution initially thinking it was a select question, then went back and realised it maybe a grid.

And no doubt AIE would do the job and using a Mirror approach will work just as good.

Good to see there are multiple tricks to resolving this issue.
And I use Mirror very often too.
As Jay kindly pointed out, this will work for a Q1 grid too with SSI Script, rather than Perl script ...
AIE(Q1,1)
ADD(Q2List,6)

Throw in Randomize() after the AIE command if you want to randomise the Q1 items at Q2.
...