Hidden Values Tutorial Part 4: Displaying an Output

Hidden Values Example 4: Show the Result of Another Question

Sometimes you will want to show the result of a  prior question or a calculation from a hidden value. There are a couple possible reasons for this:

  • You want the mobile worker to be able to see the result of a calculation or a question that was asked earlier

  • You want to test your calculation and therefore want to see the result.

The way we show the answer to another question or to a hidden value is to show what we call an output expression.  The format is <output value="..." />. Fortunately you do not have to write this out. The form builder automatically does this for you using a drag-and-drop method.

In order to show the output of a question you just need to drag it from the Question Tree to the label of the question where you want the value of the question displayed.

Let's do this for our sample form by showing the mobile user their EDD.

If we want to show the value of the hidden value "edd", you will first need a place to display it. You could show it in the label of any question but in this example we will create a label question.

  • Add a "label" question by choosing it from the Add Question drop down menu, located in the question tree.

  • Change the Question ID to "show_edd"

Now to show edd in the label text.

  • Change the Label Text to "The woman's EDD is: "

  • Click on the hidden value edd and drag it over to the Label Text box. 

  • When you see the green check mark, let go and you will see the following:  <output value="#form/edd"/>

Dragging the question:

After releasing the check mark:

When you see this question on the phone the <output value="#form/edd"/> will be replaced by the value of EDD. So it might look like: The woman's EDD is 31/08/2014.

You can drag any question to the label text box to show its output. If you drag a date question (not a hidden value showing a date, but an actual date question), then you will also have several options for formatting how the date is displayed. For more information visit Common Logic and Calculations.

It is possible to manually write expressions like this, but we recommend using the drag-and-drop method so there are no spelling or formatting errors. 

  • Click on the label question that you just made in the Question Tree and drag it until it is just underneath the question "Date of Last Menstrual Period."

Great work! You have completed the Advanced Form Logic tutorial! For more information go to the Common Logic and Calculations page!

After completing this tutorial, your Question Tree will look like this:

Return to the Application Building Tutorial Series or go on to the Basic Case Management Tutorial.


Hidden Value Calculations Tutorial Contents