Have an idea?

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

Correctly displaying constructed lists in questions

I am new to the SSI 8 web tool and programming and I think I have some beginner questions.

I want to display a contructed list in the next question. To do this I use the code: [% ListLabelsarray(NameofList) %]. There are two problems with this. First one is that displays all the options behind each other wich makes it really messy. I want it to be displayed like:

Your choices in the previous question:
- chosen answer 1
- chosen answer 2
- etc
Rest of the question..

Furthermore, the [ ] signs are still around this input, is to possible to remove these?

In the same question I want to display 'this' or 'these' depending on whether they chose 1 answer or 2 (or more) in the previous question. Is this possible?

Thanks in advance!
asked Sep 8 by Gijs
Use this script to display your codes one under each other ...
[%FormatListLabels(ListName,"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;","<br>")%]

This inserts an indent before each code and a break after. If you don't want the indent, remove all the &nbsp;.

Regarding the Perl script to display the correct script, use something like this ...
[%Begin Unverified Perl 

 my $QScript="";

 if(LISTLENGTH("ListName")==1) 
  {  
   $QScript="This blah bah blah ..."; 
  }
 
 else
  {  
   $QScript="These blah bah blah ..."; 
  }

 return $QScript;
 
End Unverified%]
It should read ...

[%FormatListLabels(ListName,"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;","<br>")%]

1 Answer

0 votes
You can use a function called ListLength to display the appropriate script.

If ListLength(Listname)=1, display "this"
Else display "these"

I'll send through an example when I arrive home.

There are other ssi script functions that provide the necessary format you require. e.g. FormatListLabels from memory?

I will add to this post with more detail within the hour. Stay tuned ...
answered Sep 8 by Paul Moon Platinum (55,975 points)
...