Imagine I have the following tree of options that I want to present in a
cascading select:
Canada
Saskatchewan
Manitoba
U.S.
Michigan
Ann Arbor
Detroit
Georgia
Atlanta
Macon
Note that the first branch only goes to depth 2 but the second branch goes
to depth 3.
Unless I'm missing something, if I have select1 elements for each of the
three levels, setup as described in the docs, I believe this will cause an
XPath error on opening the form.
The reason seems to be that the third question refers to something like:
and on form open, the system seems to be prematurely trying to find options
for that third question under the first branch which is Canada ->
Saskatchewan. When it can't find an opt tag under that path in the nodeset,
it errors.
Note that if I flip the order of U.S. and Canada it does not error. But
obviously I shouldn't have to do that. I tried adding a dummy entry under
Saskatchewan with a blank value. This does prevent the error but it also
seems a bit hackish.
Relatedly, if someone selects, say, Canada -> Manitoba and then swipes,
they get a blank set of options. I'd like to be able to hide the third
question if there are no options for it but I couldn't find a way to build
a relevance expression to accomplish this.
Would these issues be considered bugs? If so I can file.
It would seem the correct behavior would be to skip the question(s)
entirely if there are no options available and record empty string as the
answer(s).
Look forward to discussing.
···
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop *·* @sassafrastech
I think this is expected but non-optimal behavior. I usually add a
dummy entry (e.g., add a No city option under Saskatchewan) as you
did.
I'd call those bugs and they should be filed under the Javarosa core
as such. Best way to guarantee this gets fixed soon is to contribute a
patch.
Yaw
···
On Mon, Sep 22, 2014 at 7:19 AM, Tom Smyth wrote:
> Hello all.
>
> Imagine I have the following tree of options that I want to present in a
> cascading select:
>
> - Canada
> - Saskatchewan
> - Manitoba
> - U.S.
> - Michigan
> - Ann Arbor
> - Detroit
> - Georgia
> - Atlanta
> - Macon
>
> Note that the first branch only goes to depth 2 but the second branch goes
> to depth 3.
>
> Unless I'm missing something, if I have select1 elements for each of the
> three levels, setup as described in the docs, I believe this will cause an
> XPath error on opening the form.
>
> The reason seems to be that the third question refers to something like:
>
> nodeset="instance('option_set_2')/options/opt[value=/data/q2_1]/opt[value=/data/q2_2]/opt">
>
> and on form open, the system seems to be prematurely trying to find options
> for that third question under the first branch which is Canada ->
> Saskatchewan. When it can't find an opt tag under that path in the nodeset,
> it errors.
>
> Note that if I flip the order of U.S. and Canada it does not error. But
> obviously I shouldn't have to do that. I tried adding a dummy entry under
> Saskatchewan with a blank value. This does prevent the error but it also
> seems a bit hackish.
>
> Relatedly, if someone selects, say, Canada -> Manitoba and then swipes, they
> get a blank set of options. I'd like to be able to hide the third question
> if there are no options for it but I couldn't find a way to build a
> relevance expression to accomplish this.
>
> Would these issues be considered bugs? If so I can file.
>
> It would seem the correct behavior would be to skip the question(s) entirely
> if there are no options available and record empty string as the answer(s).
>
> Look forward to discussing.
>
>
>
>
> --
> Tom Smyth
> Worker-Owner, Sassafras Tech Collective
> Specializing in innovative, usable tech for social change
> sassafras.coop · @sassafrastech
>
> --
> --
> 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.
Imagine I have the following tree of options that I want to present in a
cascading select:
Canada
Saskatchewan
Manitoba
U.S.
Michigan
Ann Arbor
Detroit
Georgia
Atlanta
Macon
Note that the first branch only goes to depth 2 but the second branch goes
to depth 3.
Unless I'm missing something, if I have select1 elements for each of the
three levels, setup as described in the docs, I believe this will cause an
XPath error on opening the form.
The reason seems to be that the third question refers to something like:
and on form open, the system seems to be prematurely trying to find
options for that third question under the first branch which is Canada ->
Saskatchewan. When it can't find an opt tag under that path in the nodeset,
it errors.
Note that if I flip the order of U.S. and Canada it does not error. But
obviously I shouldn't have to do that. I tried adding a dummy entry under
Saskatchewan with a blank value. This does prevent the error but it also
seems a bit hackish.
Relatedly, if someone selects, say, Canada -> Manitoba and then swipes,
they get a blank set of options. I'd like to be able to hide the third
question if there are no options for it but I couldn't find a way to build
a relevance expression to accomplish this.
Would these issues be considered bugs? If so I can file.
It would seem the correct behavior would be to skip the question(s)
entirely if there are no options available and record empty string as the
answer(s).
Look forward to discussing.
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech
i need xls form for learning can you guide me how i can get and from where
···
On Monday, September 22, 2014 7:19:58 PM UTC+5, Tom Smyth wrote:
>
> Hello all.
>
> Imagine I have the following tree of options that I want to present in a
> cascading select:
>
> - Canada
> - Saskatchewan
> - Manitoba
> - U.S.
> - Michigan
> - Ann Arbor
> - Detroit
> - Georgia
> - Atlanta
> - Macon
>
> Note that the first branch only goes to depth 2 but the second branch goes
> to depth 3.
>
> Unless I'm missing something, if I have select1 elements for each of the
> three levels, setup as described in the docs, I believe this will cause an
> XPath error on opening the form.
>
> The reason seems to be that the third question refers to something like:
>
> nodeset="instance('option_set_2')/options/opt[value=/data/q2_1]/opt[value=/data/q2_2]/opt">
>
> and on form open, the system seems to be prematurely trying to find
> options for that third question under the first branch which is Canada ->
> Saskatchewan. When it can't find an opt tag under that path in the nodeset,
> it errors.
>
> Note that if I flip the order of U.S. and Canada it does not error. But
> obviously I shouldn't have to do that. I tried adding a dummy entry under
> Saskatchewan with a blank value. This does prevent the error but it also
> seems a bit hackish.
>
> Relatedly, if someone selects, say, Canada -> Manitoba and then swipes,
> they get a blank set of options. I'd like to be able to hide the third
> question if there are no options for it but I couldn't find a way to build
> a relevance expression to accomplish this.
>
> Would these issues be considered bugs? If so I can file.
>
> It would seem the correct behavior would be to skip the question(s)
> entirely if there are no options available and record empty string as the
> answer(s).
>
> Look forward to discussing.
>
>
>
>
> --
> Tom Smyth
> Worker-Owner, Sassafras Tech Collective
> Specializing in innovative, usable tech for social change
> sassafras.coop *·* @sassafrastech
>
I wonder if you could use a relevant with count([your nodeset with choice
filter for the 3rd question]) > 0 for your third question.
If you're not already using this, you may also find this tool useful to
quickly test XForms with manually crafted XPath
expressions: https://enketo.org/formtester.
Cheers,
Martijn
···
On Wednesday, September 24, 2014 7:07:32 AM UTC-6, Tom Smyth wrote:
>
> Anyone have any thoughts on this?
>
> On 22 September 2014 10:19, Tom Smyth <t...@sassafras.coop > wrote:
>
>> Hello all.
>>
>> Imagine I have the following tree of options that I want to present in a
>> cascading select:
>>
>> - Canada
>> - Saskatchewan
>> - Manitoba
>> - U.S.
>> - Michigan
>> - Ann Arbor
>> - Detroit
>> - Georgia
>> - Atlanta
>> - Macon
>>
>> Note that the first branch only goes to depth 2 but the second branch
>> goes to depth 3.
>>
>> Unless I'm missing something, if I have select1 elements for each of the
>> three levels, setup as described in the docs, I believe this will cause an
>> XPath error on opening the form.
>>
>> The reason seems to be that the third question refers to something like:
>>
>> > nodeset="instance('option_set_2')/options/opt[value=/data/q2_1]/opt[value=/data/q2_2]/opt">
>>
>> and on form open, the system seems to be prematurely trying to find
>> options for that third question under the first branch which is Canada ->
>> Saskatchewan. When it can't find an opt tag under that path in the nodeset,
>> it errors.
>>
>> Note that if I flip the order of U.S. and Canada it does not error. But
>> obviously I shouldn't have to do that. I tried adding a dummy entry under
>> Saskatchewan with a blank value. This does prevent the error but it also
>> seems a bit hackish.
>>
>> Relatedly, if someone selects, say, Canada -> Manitoba and then swipes,
>> they get a blank set of options. I'd like to be able to hide the third
>> question if there are no options for it but I couldn't find a way to build
>> a relevance expression to accomplish this.
>>
>> Would these issues be considered bugs? If so I can file.
>>
>> It would seem the correct behavior would be to skip the question(s)
>> entirely if there are no options available and record empty string as the
>> answer(s).
>>
>> Look forward to discussing.
>>
>>
>>
>>
>> --
>> Tom Smyth
>> Worker-Owner, Sassafras Tech Collective
>> Specializing in innovative, usable tech for social change
>> sassafras.coop *·* @sassafrastech
>>
>
>
>
> --
> Tom Smyth
> Worker-Owner, Sassafras Tech Collective
> Specializing in innovative, usable tech for social change
> sassafras.coop *·* @sassafrastech
>
The instance nodeset represents a (silly) multi-level option set with
a non-symmetrical structure. Specifically:
Green
Blue
Red
Pink
The Green option has a dummy child option with a key of
'blankoption'. This is to prevent ODK from erroring out on form load due to
a 'missing label'. This dummy child only needs to exist on the first branch
of the option tree, and the said branch should be as long as any branch.
If, e.g. Pink had a child, then the current dummy option would also need a
dummy child of its own.
The relevance expression has three and-ed clauses.
The first clause is just a regular relevance expression referring to
an earlier question.
The second clause checks that the option nodeset for the current
question has at least one option. This is what Martijn suggested. This
works perfectly for the 'Blue' option (i.e. it correctly skips question
/data/q1741_2) since Blue has no children.
However, it doesn't work for the Green option since it has a dummy
child and thus count(...) returns 1.
This is where the third clause comes in. It looks for the empty
tag that I snuck into the dummy tag beneath Green and skips
if found. Success!
Obviously this is a bit of a hack but I don't see any other way to do it
without an ODK and perhaps even JavaRosa patch.
Thoughts?
PS Thanks again Martijn!
···
On 25 September 2014 11:00, Martijn van de Rijdt wrote:
Hi Tom,
I wonder if you could use a relevant with count([your nodeset with choice
filter for the 3rd question]) > 0 for your third question.
If you're not already using this, you may also find this tool useful to
quickly test XForms with manually crafted XPath expressions: https://enketo.org/formtester.
Cheers,
Martijn
On Wednesday, September 24, 2014 7:07:32 AM UTC-6, Tom Smyth wrote:
Imagine I have the following tree of options that I want to present in a
cascading select:
Canada
Saskatchewan
Manitoba
U.S.
Michigan
Ann Arbor
Detroit
Georgia
Atlanta
Macon
Note that the first branch only goes to depth 2 but the second branch
goes to depth 3.
Unless I'm missing something, if I have select1 elements for each of the
three levels, setup as described in the docs, I believe this will cause an
XPath error on opening the form.
The reason seems to be that the third question refers to something like:
and on form open, the system seems to be prematurely trying to find
options for that third question under the first branch which is Canada ->
Saskatchewan. When it can't find an opt tag under that path in the nodeset,
it errors.
Note that if I flip the order of U.S. and Canada it does not error. But
obviously I shouldn't have to do that. I tried adding a dummy entry under
Saskatchewan with a blank value. This does prevent the error but it also
seems a bit hackish.
Relatedly, if someone selects, say, Canada -> Manitoba and then swipes,
they get a blank set of options. I'd like to be able to hide the third
question if there are no options for it but I couldn't find a way to build
a relevance expression to accomplish this.
Would these issues be considered bugs? If so I can file.
It would seem the correct behavior would be to skip the question(s)
entirely if there are no options available and record empty string as the
answer(s).
Look forward to discussing.
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech
The instance nodeset represents a (silly) multi-level option set
with a non-symmetrical structure. Specifically:
Green
Blue
Red
Pink
The Green option has a dummy child option with a key of
'blankoption'. This is to prevent ODK from erroring out on form load due to
a 'missing label'. This dummy child only needs to exist on the first branch
of the option tree, and the said branch should be as long as any branch.
If, e.g. Pink had a child, then the current dummy option would also need a
dummy child of its own.
The relevance expression has three and-ed clauses.
The first clause is just a regular relevance expression referring to
an earlier question.
The second clause checks that the option nodeset for the current
question has at least one option. This is what Martijn suggested. This
works perfectly for the 'Blue' option (i.e. it correctly skips question
/data/q1741_2) since Blue has no children.
However, it doesn't work for the Green option since it has a dummy
child and thus count(...) returns 1.
This is where the third clause comes in. It looks for the empty
tag that I snuck into the dummy tag beneath Green and skips
if found. Success!
Obviously this is a bit of a hack but I don't see any other way to do it
without an ODK and perhaps even JavaRosa patch.
Thoughts?
PS Thanks again Martijn!
On 25 September 2014 11:00, Martijn van de Rijdt martijn@enketo.org wrote:
Hi Tom,
I wonder if you could use a relevant with count([your nodeset with
choice filter for the 3rd question]) > 0 for your third question.
If you're not already using this, you may also find this tool useful to
quickly test XForms with manually crafted XPath expressions: https://enketo.org/formtester.
Cheers,
Martijn
On Wednesday, September 24, 2014 7:07:32 AM UTC-6, Tom Smyth wrote:
Imagine I have the following tree of options that I want to present in
a cascading select:
Canada
Saskatchewan
Manitoba
U.S.
Michigan
Ann Arbor
Detroit
Georgia
Atlanta
Macon
Note that the first branch only goes to depth 2 but the second branch
goes to depth 3.
Unless I'm missing something, if I have select1 elements for each of
the three levels, setup as described in the docs, I believe this will cause
an XPath error on opening the form.
The reason seems to be that the third question refers to something like:
and on form open, the system seems to be prematurely trying to find
options for that third question under the first branch which is Canada ->
Saskatchewan. When it can't find an opt tag under that path in the nodeset,
it errors.
Note that if I flip the order of U.S. and Canada it does not error. But
obviously I shouldn't have to do that. I tried adding a dummy entry under
Saskatchewan with a blank value. This does prevent the error but it also
seems a bit hackish.
Relatedly, if someone selects, say, Canada -> Manitoba and then swipes,
they get a blank set of options. I'd like to be able to hide the third
question if there are no options for it but I couldn't find a way to build
a relevance expression to accomplish this.
Would these issues be considered bugs? If so I can file.
It would seem the correct behavior would be to skip the question(s)
entirely if there are no options available and record empty string as the
answer(s).
Look forward to discussing.
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech
The instance nodeset represents a (silly) multi-level option set
with a non-symmetrical structure. Specifically:
Green
Blue
Red
Pink
The Green option has a dummy child option with a key of
'blankoption'. This is to prevent ODK from erroring out on form load due to
a 'missing label'. This dummy child only needs to exist on the first branch
of the option tree, and the said branch should be as long as any branch.
If, e.g. Pink had a child, then the current dummy option would also need a
dummy child of its own.
The relevance expression has three and-ed clauses.
The first clause is just a regular relevance expression referring
to an earlier question.
The second clause checks that the option nodeset for the current
question has at least one option. This is what Martijn suggested. This
works perfectly for the 'Blue' option (i.e. it correctly skips question
/data/q1741_2) since Blue has no children.
However, it doesn't work for the Green option since it has a dummy
child and thus count(...) returns 1.
This is where the third clause comes in. It looks for the empty
tag that I snuck into the dummy tag beneath Green and skips
if found. Success!
Obviously this is a bit of a hack but I don't see any other way to do it
without an ODK and perhaps even JavaRosa patch.
Thoughts?
PS Thanks again Martijn!
On 25 September 2014 11:00, Martijn van de Rijdt martijn@enketo.org wrote:
Hi Tom,
I wonder if you could use a relevant with count([your nodeset with
choice filter for the 3rd question]) > 0 for your third question.
If you're not already using this, you may also find this tool useful to
quickly test XForms with manually crafted XPath expressions: https://enketo.org/formtester.
Cheers,
Martijn
On Wednesday, September 24, 2014 7:07:32 AM UTC-6, Tom Smyth wrote:
Imagine I have the following tree of options that I want to present in
a cascading select:
Canada
Saskatchewan
Manitoba
U.S.
Michigan
Ann Arbor
Detroit
Georgia
Atlanta
Macon
Note that the first branch only goes to depth 2 but the second branch
goes to depth 3.
Unless I'm missing something, if I have select1 elements for each of
the three levels, setup as described in the docs, I believe this will cause
an XPath error on opening the form.
The reason seems to be that the third question refers to something
like:
and on form open, the system seems to be prematurely trying to find
options for that third question under the first branch which is Canada ->
Saskatchewan. When it can't find an opt tag under that path in the nodeset,
it errors.
Note that if I flip the order of U.S. and Canada it does not error.
But obviously I shouldn't have to do that. I tried adding a dummy entry
under Saskatchewan with a blank value. This does prevent the error but it
also seems a bit hackish.
Relatedly, if someone selects, say, Canada -> Manitoba and then
swipes, they get a blank set of options. I'd like to be able to hide the
third question if there are no options for it but I couldn't find a way to
build a relevance expression to accomplish this.
Would these issues be considered bugs? If so I can file.
It would seem the correct behavior would be to skip the question(s)
entirely if there are no options available and record empty string as the
answer(s).
Look forward to discussing.
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech
--
Tom Smyth
Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop ·@sassafrastech