Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Displaying information on a page > Text substitution > Variable response texts
Variable response texts
If you have a set of questions that use a shared or otherwise similar response list, and you provide an Other response for entering responses not in the list, you might want to include whatever the respondent enters at Other in one of the later response lists. For example, if you have some questions about how the household uses cheese and the respondent uses Other to say that the household puts cheese in mousetraps, you might want to include mousetraps as a possible response to the question about how cheese is used most frequently.
If you just use the standard {#QuestionName} method, the substitution marker is replaced by the text “Other: respondent's answer” which, although usable, doesn't look very professional. A better option is to use Label Inserts which allow you to insert a specific text into a named substitution marker. To do this, start by naming the marker and placing it in the response text. Type the response definition as:
ResponseName "{Marker}"
ResponseName is the response’s name.
Marker is a word of your choice that represents the respondent’s Other answer text.
For example:
DNOtherUses "{DNOtherText:w}"
Then add a statement to the routing section that inserts the respondent’s Other answer in the marker, as follows. The statement is quite long so it has been split across two lines, but you should type it all on one line or use an underscore at the end of very line that is continued.
Name.Categories.CatName.Label.Inserts["Marker"].Text = PrevQ.Response.Other["OtherName"]
Name is the name of the question in whose response list the substitution will occur (that is, the question you are about to ask).
CatName is the name of the response whose text will be created by substitution.
Marker is the name of the marker you have used in the metadata for this response.
PrevQ is the name of the question at which the original response was given.
OtherName is the name of the Other response in the previous question.
Here is the code for the cheese usage example. The questions are defined in the metadata as follows. The point at which the substitution is to happen is marked by {OtherText} on the penultimate line.
DNDoc define
DNWhatsNew "What's New",
DNArch "Architecture",
DNAdmin "Administation and Maintenance",
DNCustom "Customization",
DNRef "Reference"
DNAllUses "Which sections of the DDL do you normally use for
help with Interviewer Server Administrator?" categorical [1..]
Use DNDoc,
DNOtherUses "Other" other
DNMostUsed "And of those uses, which one or ones do you use
most often?" categorical [1..]
Use DNDoc,
DNOtherUses "{DNOtherText:w}"
The routing statements that display these two questions and substitute the respondent’s answer in the second response list are as follows.
    Text = DNAllUses.Response.Other["DNOtherUses"]
If the respondent chooses Other and enters “interview scripting” at DNAllUses, the fifth response in the list for DNMostUsed will show “interview scripting” exactly as the respondent typed it. If the respondent does not choose Other, this example will show an unlabeled radio button for Other in DNMostUsed. You can this by filtering the response list for the second question so that it contains only those responses chosen at the first question. If the metadata is:
mrIntDoc define
mrIntWhatsNew "What's New",
mrIntArch "Architecture",
mrIntAdmin "Administration and Maintenance",
mrIntCustom "Configuration and Customization",
mrIntPerf "Monitoring and Tuning System Performance",
mrIntRef "Reference"
mrIntAllUses "Which sections of the DDL do you normally use for
help with Interviewer Server?" categorical [1..]
Use mrIntDoc,
mrIntOtherUses "Other" other
mrIntMostUsed "And of those uses, which one or ones do you use
most often?" categorical [1..]
Use mrIntDoc,
mrIntOtherUses "{mrIntOtherText:w}"
and the respondent chooses Architecture and Other at mrIntAllUsed, the following code in the routing section will display just these options in the response list for mrIntMostUsed:
mrIntMostUsed.Categories.Filter = mrIntAllUses
    Inserts["mrIntOtherText"].Text =
See Filtering categorical response lists for further information about this type of filtering.
See also
Text substitution