This article covers these topics:
Introduction to piping
Text piping allows you to display the answer given to a previous question. It has the following syntax:
$answer(Qref) for single choice questions and $answer(Qref.ChoiceID) for multi choice questions.
You can use piping to show answers from questions of the following types:
- Single choice
- Multiple choice
- Slider
- Ranking
- Open text
- Multiple Open Text
- Open numeric
- Multiple Open Numeric
- Date/Time Input
- Barcode Scanner
- Feedback / Rating
When you are adding operands to a question text (e.g. to pipe in a value), ensure the operand is preceded by the $ sign. For example:
QMob allows piping on all operands described in conditions, but the most useful ones, relating to answers and variables, are described below.
Piping answer operands
|
Operand |
Description |
| answer(qref) |
Returns the answer to the question qref Note1: answers to multiple-choice questions are handled in a special way, as the answer variable can actually have multiple values. For example, if the respondent selected choices 2 and 5 in Q1, both the conditions answer(Q1)==2 and answer(Q1)==5 will evaluate to true. Note2: the function answer() will return different results type depending on the question type. Because of this, we recommend the use of the more specific answer functions (answerid, answerlabel, answeralias) specified here below. |
| answerid(qref) |
Returns the id(s) of the selected choice(s) in the question qref |
| answerlabel(qref) | Returns the label(s) of the selected choice(s) in the question qref |
| answeralias(qref) | Returns the alias(es) of the selected choice(s) in the question qref |
If both operands return numeric values, they will be compared as numbers, otherwise as strings. If one of the operands is wrapped inside single quotations, they will also be compared as string. In string comparison, the larger than and less than operators will compare the string length.
Piping variable operands
|
Operand |
Description |
|
var(svar) |
Returns the value of the survey variable svar |
|
global(gvar) |
Returns the value of the global variable gvar |
If both operands return numeric values, they will be compared as numbers, otherwise as strings. If one of the operands is wrapped inside single quotations, they will also be compared as string. In string comparison, the larger than and less than operators will compare the string length.