Overview
You can create a reference bubble to display in the output of any question label the answer to a previous question. Just like reference bubbles in logic, you can drag the question by dragging the question you want to display from the Question Tree to the label of the question where you want it displayed, or use the hashtag. When you drag the question onto the label box in the Basic Question Properties you will see a green check mark indicating that you can release the cursor. We recommend using this drag-and-drop method to prevent spelling or formatting errors. The question you are referencing will be shown in the label box as <output value="..." />
If you drag a date question into a question label, you can choose you will see several options for formatting when you drag the question:
- No formatting (displays the date in the default date format)
- DD/MM/YY (21/02/2012)
- DDD, MMM DD, YYYY (Fri, Sep 12, 2014)
Examples
Tip | ||
---|---|---|
|
...
This question is displaying the answer to "edd_calc" in the label. On the phone, |
...
<output value = "/data/edd_calc"/> will appear to the user as whatever edd_calc is defined as. For |
...
example "Her estimated date of delivers is /02/2012" |
...
or "Her estimated date of delivery is Fri, Sep 12, 2014"
|
...
|
Other notes about output expressions:
- It is also possible to manually compose an output expression. For example, to display the answer to the question with the ID mother_name, type the following in the display text of a question later in the form: <output value="/data/mother_name"/>
- To display the answer to a question that is in a group, be sure to show the full path: <output value="/data/mother_questions/mother_name"/>
- To manually format format the display of a date: <output value="format-date(/data/edd_calc, '%e/%n/%y')"/>
- An output expression will not update automatically if it relies on a question (or on a hidden value that relies on a question) that appears on the same page/screen (if you are using a Question List) as the output expression. Bear this in mind when deciding where to place an output expression.
...
- To show the label text of a choice instead of the item value you can use the following syntax: <output value="jr:itext(concat('question-', /data/question,'-label'))"/>. Note that this may not work if you have copied a question, because the itext ID may not match the question ID. For example, if you want to display the choice label for a question with the question ID site, in a group called intro (i.e. /data/intro/site) the expression would look like: <output value = "jr:itext(concat('intro/site-', /data/intro/site,'-label'))"/>.
For more guidance, see the Hidden Values Tutorial Part 4: Displaying an Output