In this article
Text Substitution and Response Piping
You can retrieve text or values from a question and insert it into the question wording of another question. To do this, use the caret character (^) in front of and after a Jscript expression. This can be used in all text fields, for example, Title, Text, Instruction and Answer list/scale. Note however that this cannot be used in script nodes, conditions, code masks or validation code fields.
Example:
The code ^f("name")^ is inserted in the text field.
Figure 1 - The TVchannels question
The respondent will see the question as shown here in the figure below (the name will be different of course).
Figure 2 - The "TVchannels" question with text substitution
The two tables below show texts returned from ^f("qID")^ and ^f("qID")["code"]^ for different question types:
Question type |
Returned from ^f("qID")^ |
Open text |
The text answered in the text box. |
Single |
The text from the answer list corresponding to the code returned from f("qID") in the current language. |
Multi, Ranking, Open Text List, and Numeric List |
The text(s) from the answer list corresponding to the code(s) returned from f("qID") in the current language. If more than one, the answer will be separated by comma and with "and" (in the current language) between the last two items. |
Other property of answer lists |
The text answered in the text box. (The question ID is qID_code_other (go to Question Properties Overview for more information)) |
Loop |
The text of the loop member corresponding to the iteration with code qID in the current language. |
Question type |
Returned from ^f("qID")["code"]^ |
OpenText List, Numeric List or Ranking property |
The text answered in the text box. |
Grid |
The answer from the scale corresponding to the code returned from f("qID")["code"] in the current language. |
The same rules apply to loop questions, but there you may also need to specify the iteration(s).
Drag and Drop Piping
To simplify the use of answer piping in WYSIWYG mode, you can drag-and-drop questions from the Survey tree toolbox into the text elements of other pages in the survey. Drag the required item from the tree and drop it into the text area where piping is required.
Note that this can be done only when in WYSIWYG mode. Click the Switch Between Modes button in the Question Details page toolbar to change modes.
The question types:
- Single
- Multi
- Ranking
- Open text
- Numeric
- Date
can be dragged into the Title, Text, Instruction and Language texts for codes. The action will place, for example, ^f('q2')^ into the text field (in this example the object dragged was q2) - .
Figure 3 - Example of dragging-and-dropping a question for piping
Note: In the event you attempt to drag-and-drop questions while you are in HTML mode, spurious characters or "coding" may result. Ensure that all such is removed from the text fields before you attempt to launch the survey.
The answerlist view of codes is NOT supported.