Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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" (or "display text") of a choice instead of the choice 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'))"/>.

    • This also may not work if you have several single select or multiple select questions that use the same set of options. When your application is built, questions that share choices are combined, to make the form smaller and faster. This means that if you reference a question that uses the exact same set of choices as another question, referencing that question's ID may cause an error.

For more guidance, see the  Hidden Values Tutorial Part 4: Displaying an Output.

Displaying based on a range

...

You can also write display logic for questions you want to appear at a certain time of year using format-date. For example, if you'd like a question to appear only in the month of August, you'd put format-date(date(today()), '%n') = 8 in the display condition. See format-date on the functions pagehttps://dimagi.atlassian.net/wiki/spaces/commcarepublic/pages/2143957589/CommCare+Functions#format-date.

Display the number of times a form has been filled out

...