Scripting > mrScriptMetadata User's Guide > mrScriptMetadata reference > Label text insertion > Response insertions
 
Response insertions
Response insertions are used to insert an answer to a previous question into the label text. You can also use this type of insertion to insert the value of a variable from an interview script's routing section.
Response insertions are specified by prefixing the name of the previous question with a # character. In the following example, the answer to question Child_Name will be automatically inserted in the label of question Child_Age:
Child_Name "What is the child's name?" text [2..50];
Child_Age "What is the age of {#Child_Name}?" long [0..18];
If the answer to question Child_Name is “Rose”, the text of question Child_Age will be “What is the age of Rose?”.
If a previous question with the same name as the response insertion doesn't exist, the value of a variable with that name from the interview script's routing section is inserted instead. In this example, the routing section of an interview script contains the following code:
Dim sBrandName
sBrandName = "Chocomagic"
To generate the question text “What's your opinion of Chocomagic”, you would write the question like this:
Brand_Opinion "What's your opinion of {#sBrandName}?" text;
To refer to a question at the document level from within a loop, use the root level (\.) operator. In the following example, the answer to question Q10 is inserted in the labels of the categories inside the loop of question Q11:
Q10 "Which brand of polish do you use?" text [1..20];

Q11 "Please compare {#Q10} with the following brands" loop
{ VeryShiny, GleamAndGlint, LooksLikeNew }

fields (
compare_brand categorical [1..1]
{
Better "Better than {#\.Q10}",
Same "Same as {#\.Q10}",
Worse "Worse than {#\.Q10}"
};
) expand;
If the answer to question Q10 is “SuperPolish”, the label of the category named Better in question Q11 will be “Better than SuperPolish”, the label of the category named Same will be “Same as SuperPolish”, and so on.
It is not possible to refer to a higher-level question that is not at the document level, for example, a higher-level question that is within a loop. This might be a feature of a future version of UNICOM Intelligence.
See
Label text insertion