Appendix: Using Keywords in Question Text

Identifier and question keywords can be included in question text, causing their values to appear as part of that text. This can be done with any type of question that has visible question text, including buttons.

You must add a question to the expression parser before you can display its value using this method.

When you include a keyword in a question's text, it must written with a pair of tilde symbols (~) either side, as shown in the following example:

~~Keyword~~

For example, if you have a question with the keyword Name, whose value you want the user to confirm in a later question group, you could create a second question with the following question text:

Is ~~Name~~ your name?

In this example, if an end user responds "Aaron Aaronson" to the Name question, that response will be added to the expression parser the next time a Postback occurs. On viewing the question that references Name, the user would see the following:

Is Aaron Aaronson your name?

If the keyword refers to a question or variable that has not been initialised—for example, if the question has either not been loaded or not added to the expression parser—the question text will display the literal string exactly as written, including tildes. The following example demonstrates what would appear to an end user if the Name keyword had been initialised, but the DateOfBirth keyword had not:

Your name is Aaron Aaronson and your date of birth is ~~DateOfBirth~~.

If the keyword refers to an optional question that has been initialised but not answered, the resulting question text will display nothing in place of the keyword. The following example shows how, after initialising Name and the optional DateOfBirth, leaving the second question blank would affect the resulting question text:

Your name is Aaron Aaronson and your date of birth is .

It is a good idea to use visibility expressions to conditionally hide content that relies on other, optional content.

You can include as many keywords as needed in a single question's text. The following example contains a number of identifiers combined with static question text:

Dear ~~Title~~ ~~Surname~~. Thank you for your order received on ~~OrderDate~~. Your ~~ProductName~~ will be delivered to ~~FirstAddressLine~~ in 3-5 business days.