Have an idea?

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

Giving New Labels to Text-value pass-ins

Hello all,

I'm passing in a text value called "brand". However, it is not formatted the way it needs to be to show to a respondent (e.g., since you can't use a space in a URL, the value for "Ace Hardware" is "ace").

I need to display a "pretty" version of the pass-in brand name on the very first question after the Start page. Is there a way to assign a new label to a pass-in field without being able to create a list for it?

Note: I've already got my "brand" text values converted into Numeric values, if that helps. See this post:
asked Mar 18, 2014 by cschlosser Bronze (1,005 points)

1 Answer

0 votes
I'm not sure where your url's are coming from but consider the EncodeForURL(QuestionName) function in future.

If you have a shortened version list and want to convert it to a full version list, you will have to create the full version list.

There is a handy function called Mirror which enables you to program a constructed list where different parent lists are involved.

Here's the Sawtooth Help ...


Adds list members from the parent list that correspond to the list values in ListName.

The format is:

MIRROR (ListName)
MIRROR (ListName, Offset)

Mirror is useful to map or mirror one list onto another when those lists have different parents.  For example suppose that you have a list of colors:

1 - Red
2 - Blue
3 - Green
4 - Purple
5 - White

and you also have a list of images

1 - <img src="[%GraphicsPath()%]red.jpg">
2 - <img src="[%GraphicsPath()%]blue.jpg">
3 - <img src="[%GraphicsPath()%]green.jpg">
4 - <img src="[%GraphicsPath()%]purple.jpg">
5 - <img src="[%GraphicsPath()%]white.jpg">

In addition there is a constructed list named ColorsChosenList.  When the survey is run imagine that it had items 1,3, and 4.  If you wanted to create a constructed list from ColorImagesList that corresponded to the same items in ColorsChosenList you could do this:

MIRROR (ColorsChosenList)

This command would add these items:

1 - <img src="[%GraphicsPath()%]red.jpg">
3 - <img src="[%GraphicsPath()%]green.jpg">
4 - <img src="[%GraphicsPath()%]purple.jpg">

The optional Offset parameter allows you to alter the mapping adding the value specified in Offset to each value in ListName.  For example:

MIRROR (ColorsChosenList, 1)

would return:

2 - <img src="[%GraphicsPath()%]blue.jpg">
4 - <img src="[%GraphicsPath()%]purple.jpg">
5 - <img src="[%GraphicsPath()%]white.jpg">
answered Mar 18, 2014 by Paul Moon Platinum (65,230 points)