# Skip patterns not working in ODK Collect form built in ODK Build

**URL:** <https://forum.getodk.org/t/skip-patterns-not-working-in-odk-collect-form-built-in-odk-build/5270>\
**Category:** Support\
**Created:** [February 18, 2016, 10:07pm UTC](https://forum.getodk.org/t/skip-patterns-not-working-in-odk-collect-form-built-in-odk-build/5270 "2016-02-18T22:07:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adammeds360](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@Adammeds360](https://forum.getodk.org/u/Adammeds360)\
**Post date:** [February 18, 2016, 10:07pm UTC](https://forum.getodk.org/t/skip-patterns-not-working-in-odk-collect-form-built-in-odk-build/5270/1 "2016-02-18T22:07:00Z")

</div>

Hi, everyone. I am brand new to ODK (and XML Forms for that matter) and  
have successfully set up ODK Collect and Aggregate. My form that I built in  
ODK Build has shown up in ODK Collect on the tablet (it is a valid form  
according to ODK Validate). BUT....I cannot get the skip pattern to work ☹

For some reason my form on ODK Collect does not display the questions that  
are dependent on the previous one (i.e., skip patterns not working). I set  
up the first skip pattern the following way: I created two Groups: Group 1  
has 3 questions and in the Group 1 Properties I have it so that it is  
relevant if Q4 = 1 (i.e., 'Yes'). I did the same for Group 2 but in this  
case it is if Q4 = 0 (i.e., 'No'). None of the questions in either Group 1  
or 2 show up on the form regardless of how I answer Q4. In the Group 1 and  
2 Properties section I have not checked Looped or Display On One Screen.  
Could it be this?

I also have a question at the end that is dependent on the previous one.  
Since it is only one question I just put the condition in the Relevance  
field: Q10 = 1.

None of the questions that have a Relevance statement appear on my ODK  
Collect form.

Note that I have made all of my questions Required.

Any and all help would be greatly appreciated!!

Thanks!

Best,  
Adam

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [February 18, 2016, 10:38pm UTC](https://forum.getodk.org/t/skip-patterns-not-working-in-odk-collect-form-built-in-odk-build/5270/2 "2016-02-18T22:38:39Z")

</div>

_1st:_ do not send posts to both opendatakit@ and opendatakit-developers@.

This question is appropriate for opendatakit@.

The other list is for people that are writing or modifying the Java  
software. Sending to both does not raise the visibility of the issue. It  
just irritates the 100's of people that are on both lists and who see 2  
separate, identical, messages.

ODK Build does not recognize the ${fieldname} syntax available in XLSForm.  
If you want to reference another field's value, you must either provide the  
full XPath to that field (e.g., /data/group1/nestedgroup3/fieldA ) or a  
relative XPath (e.g., ../../nestedgroup3/fieldA ). If all your fields are  
in the same group in ODK Build, then you can reference them via  
../otherfieldname

Otherwise, the path is easiest to construct by first generating an XML  
document from ODK Build and viewing its block (in an editor like  
notepad++). The instance block describes the structure of the groupings and  
fields within your form.

Most people find that XLSForm is easier to use for larger forms because of  
its ${fieldname} shorthand (which is automatically converts to a full XPath  
expression to the field).

So, in summary:

Group 1 cannot have a relevant condition that is dependent upon the values  
of the fields within group 1.

I assume, therefore that Q4 is asked outside of Group 1 and Group 2.

The relevant condition for these two groups is evaluated relative to being  
at/on/in that group.

So to refer to Q4, you likely need to use:

../Q4

Now, you state that Q4 has two values 0 and 1, for "No" and "Yes".  
This implies that you wrote it as a select-one question, with 2 choices.

In that case, the values 0 and 1 are not actually integer values -- they  
are string values (all select-one and select-multiple choices are  
strings). And:

"0" != 0

So your relevant conditions likely need to be:

../Q4 = "1"

../Q4 = "0"

And if Q4 is in some other group, you would need to adjust the path to  
refer to that group.

The ODK Validate tool

> **[ODK - Collect data anywhere](https://getodk.org/)**
>
> Powerful forms to collect the data you need wherever it is. Join the researchers, field teams, and other professionals using ODK to collect data that matters.

can be useful to validate the generated XML file to verify that it is  
well-formed.  
I think it should catch bad field references.

> **···**
>
> On Thu, Feb 18, 2016 at 2:07 PM, wrote:
> 
> > Hi, everyone. I am brand new to ODK (and XML Forms for that matter) and  
> > have successfully set up ODK Collect and Aggregate. My form that I built in  
> > ODK Build has shown up in ODK Collect on the tablet (it is a valid form  
> > according to ODK Validate). BUT....I cannot get the skip pattern to work ☹
> > 
> > For some reason my form on ODK Collect does not display the questions that  
> > are dependent on the previous one (i.e., skip patterns not working). I set  
> > up the first skip pattern the following way: I created two Groups: Group 1  
> > has 3 questions and in the Group 1 Properties I have it so that it is  
> > relevant if Q4 = 1 (i.e., 'Yes'). I did the same for Group 2 but in this  
> > case it is if Q4 = 0 (i.e., 'No'). None of the questions in either Group 1  
> > or 2 show up on the form regardless of how I answer Q4. In the Group 1 and  
> > 2 Properties section I have not checked Looped or Display On One Screen.  
> > Could it be this?
> > 
> > I also have a question at the end that is dependent on the previous one.  
> > Since it is only one question I just put the condition in the Relevance  
> > field: Q10 = 1.
> > 
> > None of the questions that have a Relevance statement appear on my ODK  
> > Collect form.
> > 
> > Note that I have made all of my questions Required.
> > 
> > Any and all help would be greatly appreciated!!
> > 
> > Thanks!
> > 
> > Best,  
> > Adam
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)

---

<div class="post-metadata">

**Author:** ![Vsamuel](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/v/cdc98d/32.png) [@Vsamuel](https://forum.getodk.org/u/Vsamuel)\
**Post date:** [February 21, 2017, 7:12am UTC](https://forum.getodk.org/t/skip-patterns-not-working-in-odk-collect-form-built-in-odk-build/5270/3 "2017-02-21T07:12:34Z")

</div>

I have similar but different question. I have repeat group in my form and I would like some questions to be responded once i.e. if the first participant says Yes then the question should not appear for the second participant in that repeat group. Any thoughts?

---

<div class="post-metadata">

**Author:** ![Adammeds360](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@Adammeds360](https://forum.getodk.org/u/Adammeds360)\
**Post date:** [February 18, 2016, 10:59pm UTC](https://forum.getodk.org/t/skip-patterns-not-working-in-odk-collect-form-built-in-odk-build/5270/4 "2016-02-18T22:59:56Z")

</div>

Hi, Mitch. I deleted the first post to the developers site - you must've  
caught it in the 1 minute or so that it was actually there before I deleted  
it and posted it here. 1st task - Check.

I figured out how to get the skip patterns to show by correcting the XPath.  
In the Relevance statement, when I put  
/data/Q4 = 1 the 1 is referring to the underlying values assigned to the  
Options (Yes = 1, No = 0) so I did not have to use the " ".

Thanks for the prompt response!

Cheers,  
Adam

> **···**
>
> On Thursday, February 18, 2016 at 2:38:43 PM UTC-8, Mitch Sundt wrote: \> \> \*1st:\* do not send posts to both opendatakit@ and \> opendatakit-developers@. \> \> This question is appropriate for opendatakit@. \> \> The other list is for people that are writing or modifying the Java \> software. Sending to both does not raise the visibility of the issue. It \> just irritates the 100's of people that are on both lists and who see 2 \> separate, identical, messages. \> \> ODK Build does not recognize the ${fieldname} syntax available in XLSForm. \> If you want to reference another field's value, you must either provide the \> full XPath to that field (e.g., /data/group1/nestedgroup3/fieldA ) or a \> relative XPath (e.g., ../../nestedgroup3/fieldA ). If all your fields are \> in the same group in ODK Build, then you can reference them via \> ../otherfieldname \> \> Otherwise, the path is easiest to construct by first generating an XML \> document from ODK Build and viewing its block (in an editor like \> notepad++). The instance block describes the structure of the groupings and \> fields within your form. \> \> Most people find that XLSForm is easier to use for larger forms because of \> its ${fieldname} shorthand (which is automatically converts to a full XPath \> expression to the field). \> \> So, in summary: \> \> Group 1 cannot have a relevant condition that is dependent upon the values \> of the fields within group 1. \> \> I assume, therefore that Q4 is asked outside of Group 1 and Group 2. \> \> The relevant condition for these two groups is evaluated relative to being \> at/on/in that group. \> \> So to refer to Q4, you likely need to use: \> \> ../Q4 \> \> Now, you state that Q4 has two values 0 and 1, for "No" and "Yes". \> This implies that you wrote it as a select-one question, with 2 choices. \> \> In that case, the values 0 and 1 are not actually integer values -- they \> are string values (all select-one and select-multiple choices are \> strings). And: \> \> "0" != 0 \> \> So your relevant conditions likely need to be: \> \> ../Q4 = "1" \> \> ../Q4 = "0" \> \> And if Q4 is in some other group, you would need to adjust the path to \> refer to that group. \> \> The ODK Validate tool \> https://opendatakit.org/downloads/download-category/validate/ \> can be useful to validate the generated XML file to verify that it is \> well-formed. \> I think it should catch bad field references. \> \> \> On Thu, Feb 18, 2016 at 2:07 PM, \<adamm...@gmail.com \> wrote: \> \>\> Hi, everyone. I am brand new to ODK (and XML Forms for that matter) and \>\> have successfully set up ODK Collect and Aggregate. My form that I built in \>\> ODK Build has shown up in ODK Collect on the tablet (it is a valid form \>\> according to ODK Validate). BUT....I cannot get the skip pattern to work :-( \>\> \>\> For some reason my form on ODK Collect does not display the questions \>\> that are dependent on the previous one (i.e., skip patterns not working). I \>\> set up the first skip pattern the following way: I created two Groups: \>\> Group 1 has 3 questions and in the Group 1 Properties I have it so that it \>\> is relevant if Q4 = 1 (i.e., 'Yes'). I did the same for Group 2 but in this \>\> case it is if Q4 = 0 (i.e., 'No'). None of the questions in either Group 1 \>\> or 2 show up on the form regardless of how I answer Q4. In the Group 1 and \>\> 2 Properties section I have not checked Looped or Display On One Screen. \>\> Could it be this? \>\> \>\> I also have a question at the end that is dependent on the previous one. \>\> Since it is only one question I just put the condition in the Relevance \>\> field: Q10 = 1. \>\> \>\> None of the questions that have a Relevance statement appear on my ODK \>\> Collect form. \>\> \>\> Note that I have made all of my questions Required. \>\> \>\> Any and all help would be greatly appreciated!! \>\> \>\> Thanks! \>\> \>\> Best, \>\> Adam \>\> \>\> -- \>\> -- \>\> Post: opend...@googlegroups.com \>\> Unsubscribe: opendatakit...@googlegroups.com \>\> Options: http://groups.google.com/group/opendatakit?hl=en \>\> \>\> --- \>\> You received this message because you are subscribed to the Google Groups \>\> "ODK Community" group. \>\> To unsubscribe from this group and stop receiving emails from it, send an \>\> email to opendatakit...@googlegroups.com . \>\> For more options, visit https://groups.google.com/d/optout. \>\> \> \> \> \> -- \> Mitch Sundt \> Software Engineer \> University of Washington \> mitche...@gmail.com \>

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [March 2, 2017, 9:21pm UTC](https://forum.getodk.org/t/skip-patterns-not-working-in-odk-collect-form-built-in-odk-build/5270/5 "2017-03-02T21:21:02Z")

</div>

I can't think of an easy way to do this. If you can describe the  
specific use-case, perhaps others will have alternative approaches.

Yaw

> **···**
>
> On Tue, Feb 21, 2017 at 2:12 AM, wrote: \> I have similar but different question. I have repeat group in my form and I would like some questions to be responded once i.e. if the first participant says Yes then the question should not appear for the second participant in that repeat group. Any thoughts? \> \> -- \> -- \> Post: opendatakit@googlegroups.com \> Unsubscribe: opendatakit+unsubscribe@googlegroups.com \> Options: http://groups.google.com/group/opendatakit?hl=en \> \> --- \> You received this message because you are subscribed to the Google Groups "ODK Community" group. \> To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. \> For more options, visit https://groups.google.com/d/optout.
