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

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 :frowning:

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

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

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 :frowning:

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
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.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

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?

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 >

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.
1 Like