Have an idea?

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

Adding answer items chosen in a ranking question to a constructed list

Hello,

I have a ranking type question (#28) where respondents can rank as many of the 14 items they wish.

In q43, I would like to show a list of the items they ranked (regardless of rank, just if they ranked it or not) in q23 plus 7 new additions to the list.

My "Q43Construct" has "Q43RowList" as the parent which lists the 14 answer choices from q28 and my 7 new additions.

During testing only my 7 new additions appear in the answer choices for q43.  I tried GETVALUE which didn't work, neither did ANE. Not sure what the right command is for this type of question but I can't figure it out.

Q43Construct instructions:
Begin Unverified Perl

if (ANE("Q28_1", 0)) {
    ADD("Q43Rowlist", 1);
}
if (ANE("Q28_2", 0)) {
    ADD("Q43Rowlist", 2);
}
if (ANE("Q28_3", 0)) {
    ADD("Q43Rowlist", 3);
}
if (ANE("Q28_4", 0)) {
    ADD("Q43Rowlist", 4);
}
if (ANE("Q28_5", 0)) {
    ADD("Q43Rowlist", 5);
}
if (ANE("Q28_6", 0)) {
    ADD("Q43Rowlist", 6);
}
if (ANE("Q28_7", 0)) {
    ADD("Q43Rowlist", 7);
}
if (ANE("Q28_8", 0)) {
    ADD("Q43Rowlist", 8);
}
if (ANE("Q28_9", 0)) {
    ADD("Q43Rowlist", 9);
}
if (ANE("Q28_10", 0)) {
    ADD("Q43Rowlist", 10);
}
if (ANE("Q28_111", 0)) {
    ADD("Q43Rowlist", 11);
}
if (ANE("Q28_12", 0)) {
    ADD("Q43Rowlist", 12);
}
if (ANE("Q28_14", 0)) {
    ADD("Q43Rowlist", 14);
}
{ADD("Q43Rowlist",15,21)}

End Unverified


Also tried
if (GETVALUE("Q28_1")) {
    ADD("Q43Rowlist", 1);
}
asked Nov 17, 2022 by Rick (310 points)

1 Answer

0 votes
There are a few issues with this Perl script, but you should be able to skip the Perl entirely. To add all ranked items (regardless of rank) to the constructed list you can use the List Instruction:

AIG(RankingQuestionName, 0)

or even:

AddSorted(RankingQuestionName)
answered Nov 17, 2022 by Cameron Halversen Bronze Sawtooth Software, Inc. (625 points)
Thanks works perfect
...