Shared Lists | smarter Dimensions

Shared Lists

Wednesday, January 28th, 2009 | Interviewing, Scripting

When we create questions using the Interview Object Model  ( IOM ) we need to have responses that the respondent can select. More often than not we need to have the same responses used multiple times. This article is about Shared lists that allow you to create the list’s once and then re-use them as often as you need.

Shared lists as mentioned above, help you re-use responses and make your scripts easier to manage and reduce your script size. You can place these lists anywhere in your script, however mrStudio will move them to the very top of your script making them easy to find and modify.

The structure of a shared list is :

[ListName] define
{
[ResponseName] [ResponseText],
};

where

ListName: is the name of the list. It is sensible to make the name of the list reflect the content of the list.

define: is the keyword to create the list

ResponeName: is the name that identifies the response text. It should be noted that response names:

  • Must start with a letter
  • They may only contain Numbers, Letters or the Underscore character

ResponseText: is the text that is displayed to the user. If there is more than one response then each response apart from the last must be followed by a comma

Examples of Shared Lists

YesNo "" define
{
Yes,No
};
GoodBad "" define
{
_1 " 1 - Bad",
_2 " 2",
_3 " 3",
_4 " 4",
_5 " 5",
_6 " 6",
_7 " 7",
_8 " 8",
_9 " 9",
_10 "10 - Good"
};

Now that we have our shared lists we need to know how to use them, so lets take the YesNo List and use it in the Question  “Did you drive to work today?”. Type the following in the metadata section.

Drive "Did you drive to work today" categorical [1]
{
use YesNo
};

So we can se that we need to specify the use keyword followed by the list name. It should also be noted that you can add more that one shared list together or add additional responses to the question for example. If we wanted to add a “Don’t Know” to our Drive question we would just need to add the following code.

Drive "Did you drive to work today" categorical [1]
{
use YesNo,
DontKnow "Don't Know" DK
};

So if we want to add more responses to the question then we just add a coma to the last response and add the next one after that, just like we do when we are adding additional responses to our questions.

2 Comments to Shared Lists

rbateman
3 February, 2009

Your rules for identifier names are woefully incomplete. First, identifiers can start with any Unicode 3.0 letter OR the underscore. Also, subsequent letters can be any Unicode 3.0 letter, decimal number or the characters @,$,# or _. See DDL.chm::/sql_identifier_regular.htm

admin
3 February, 2009

Thanks for noticing the typo, you are correct it should have been “Or” the underscore not “and”. :-)

You are also correct in pointing out that you can have more starting characters for the identify names than listed. Writing surveys in foreign languages is going to be covered in a future article and the characters allowed as identifying names will be explored further there.

Leave a comment

Categories

Blog Counts

Search

Archives

PHP Notice: A feed could not be found at http://twitter.com/statuses/friends_timeline/16449757.rss in F:\hshome\anncoona\smarterdimensions.com\Blog\wp-content\plugins\external-rss-reader\inc\simplepie.inc on line 1780