Using the display condition.

56 views
Skip to first unread message

Daniel LUBA

unread,
Oct 21, 2015, 7:55:23 AM10/21/15
to commcare-users
I am designing an application for the first time.
I have followed all the examples in the guide on the display condition but am getting error when i deploy.
The question is a multiple choice multiple answer

What do you think is the cause of diarrhea?
1. Flies
2. Contaminated food
3. Contaminated hands
4. Others specify

I want to skip the next question which is (please specify other) in case choice 4 is not selected. How can i go about it?

William Pride

unread,
Oct 21, 2015, 8:45:14 AM10/21/15
to commcare-users
Hello Daniel,

I'd recommend checking out the documentation about the selected() function. Specifically, if your four option has the associated value "other" your relevancy statement for the next question would be something like selected(/data/multiple_choice_question, 'other')

Best,
Will

--
You received this message because you are subscribed to the Google Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel LUBA

unread,
Oct 21, 2015, 9:24:19 AM10/21/15
to commcar...@googlegroups.com
Thanks William, i have used it but it also brings an error message.

--
You received this message because you are subscribed to a topic in the Google Groups "commcare-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/commcare-users/Hb0J9ZATEE0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to commcare-user...@googlegroups.com.

William Pride

unread,
Oct 21, 2015, 9:24:56 AM10/21/15
to commcare-users
Could you post the error message you're seeing?

Simon Berry

unread,
Oct 22, 2015, 2:32:44 AM10/22/15
to commcare-users
Hi Daniel

We have exactly the same flow in many of our forms. I attach a screen shot which shows how we achieve what you are wanting to achieve. We don't skip the next question we include prompting for the 'other' specification within a question list (in the screenshot 'Wholesaler used') is a question list which includes the multiple choice options AND the option to specify the 'other' choice.

Simon
Google ChromeScreenSnapz046.png

Daniel LUBA

unread,
Oct 22, 2015, 2:34:27 AM10/22/15
to commcare-users

Build Failed!

Validation Error: Dependency cycles amongst the xpath expressions in relevant/calculate

More information:
Error: XPath Dependency Cycle:
/data/cause_dios => /data/cause_dios
in form WASH Mini FU Survey 2015 form in module "Health, Hygiene, Water and Sanitation"

Daniel LUBA

unread,
Oct 22, 2015, 3:58:30 AM10/22/15
to commcare-users

For the display condition section you are stating the conditions under which you want the question to be displayed (NOT the situation in which it should skip).

For example, consider a question that asks for a cellphone number.  We only want to show that question if the answer to the previous question ("Do you have a cellphone?") is yes.

  1. Once in the expression editor click "add expression"
  2. From the question tree, drag the "Do you have a cellphone?" question over to the first box until the mouse shows a green check mark- then drop it in.
  3. Grab the "yes" answer from the "Do you have a cellphone?" question and drag that into the second box.
  4. Make sure that the drop down menu between the boxes says "is equal to."
  5. Verify that a green "OK" box appears at the end of the expression
  6. Click "save to form"- you will see the expression now appears in the box next to "skip condition"
Now this question will only show when the answer to "Do you have a cellphone?" is "Yes."

I have used the above example but the error message i get is (The Display Condition for a question is not allowed to reference the question itself. Please remove the . from the Display Condition or your form will have errors.) how else can i do it.


On Wednesday, October 21, 2015 at 2:55:23 PM UTC+3, Daniel LUBA wrote:

Jeremy W.

unread,
Oct 22, 2015, 5:20:14 PM10/22/15
to commcar...@googlegroups.com
Hello, Daniel,

That error message often shows up if you accidentally drag the question in which you are building the display condition into the expression builder, instead of the question you wanted to reference. So, in your example, if you accidentally dragged "What is your number?" (instead of "Do you have a cellphone?") into the display condition for "What is your number?" you would see a . instead /data/phone_number. I recommend deleting the display condition and trying to create it again.

Hope this helps!

Jeremy

--

Daniel LUBA

unread,
Oct 23, 2015, 2:53:29 AM10/23/15
to commcare-users
Thanks Jeremy, let me try it.


On Wednesday, October 21, 2015 at 2:55:23 PM UTC+3, Daniel LUBA wrote:
Reply all
Reply to author
Forward
0 new messages