Have an idea?

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

Showing the Items of a Constructed List


Probably a simple question.  I'm building a constructed list and I want to SHOW these items as Text on the following page of what was selected.

For instance, what brands of breakfast cereal do you eat?  It is bringing together 2 questions, which is working (list max is 3)... Now I want to SHOW the list of 3 items that were picked...

I believe I use the <ol> function, but it keeps saying my list is empty.  Or something to this nature.  Please let me know what the instruction is, or what is the best way.

Programming in SSI Web 7
Not sure if I use a Perl instruction?
asked May 17, 2019 by anonymous
When you say you are trying to show the list as text on the following page, is that in the question text or as the responses?
Hi Paul,

I'd  like to show the RESPONSES from the list that the respondent chose. So say they chose, Trix, Fruit Loops, Honey Comb and Corn Flakes, I want to show the list responses of say Fruit Loops, Honey Comb and Corn Flakes if that was the listmax list of 3 that was constructed...

Does that help?
So do you want those selected items to appear as response options or in question script?
I'd like it just as script - say as a text type question, I just want to see the items selected like this:
Your top 3 breakfast cereals were:

1. Fruit Loops
2. Honey Comb
3. Corn Flakes

You might need to check if this SSI Script function (FormatListLabels) actually exists in your v7.
<ol>[%FormatListLabels(Q2ConList,"<li>", "</li>")%]</ol>
I know this works in v9.

1 Answer

0 votes
If it is in response options at the following page, create a constructed list as follows ...

Assume your first question is Q1 and it uses a list called Q1List.

Let's call this constructed list Q2ConList.

This constructed list will add all items selected at Q1, randomise those selected items, and then trim the list to a maximum of 3 items.

If at Q2 you want to display these items as response options, select the Q2ConList constructed list as your list.

Does that help?

If you need to display the items in the question script, there are some SSI Script functions we can use like ...

[%FormatListLabels (ListName,"BeforeText", "AfterText")%]
answered May 17, 2019 by Paul Moon Platinum (98,670 points)
Is there a way I can get the responses from this constructed list to show as separate lines of text?  

I want to individualize each item - so what I'm trying to say is show each item chosen in a separate line on a text type question?  so...
show ITEM1
show ITEM2
show ITEM3

Like this
1. Fruit Loops
2. Honey Comb
3. Corn Flakes

I tried this [%ListLabelsArray(ListName)%] and it just jumbled it all together.  We need to do taste testing so I need to have each item in a spelled out list so we can clearly see what was chosen...

Sometimes it's hard to explain without talking it through, does that make sense?
Did you try the solution I provided?
I did, I think it works.  Thanks for your help.  I'll get back to you a bit later if I need anything additional.
Great, I was unsure if the function was available back in the v7 days. I know that solution works in v8+.

Certainly keep using the Sawtooth Software forum if you need guidance. There's a ton of assistance here.
Paul, one more thing... is there a function I can use to show the item selected FIRST in a constructed list? Not the first option, the item SELECTED first.

Simply display the first item's label as follows ...

To display the 5th item's label, use the following ...

And to display the value rather than the label, use ListValue.
I have a loop that is working but it keeps showing the first item on each loop. I am using this type of question coding:
<span class="english language">Relation of [%LOOPLABEL()%]</span>
Ideas of why this might not be working? I think my list is set up well..
Providing you have your loop and constructed list setup correctly, using [%LoopLabel()%] should work fine.

Ensure your constructed list is being calculated correctly by conducting tests of your own. And ensure your loop anchor questions are correct too.

If you are using nested loops, you should include the loop name in your loop function (e.g. [%LoopLabel(Loop1)%]).