Hi all,
I would like to reference to the label of an (categorical) answer instead of value which we do like this ${variable}. I have done a bit of research but I've not found a clue.
Does anyway have a solution?
Thanks.
Trugn
Hi all,
I would like to reference to the label of an (categorical) answer instead of value which we do like this ${variable}. I have done a bit of research but I've not found a clue.
Does anyway have a solution?
Thanks.
Trugn
I don't think there is an easy way to do this. The only way I can think of
would be to make a formula with a bunch of nested "if" statements that
returns the label corresponding to the variable's value. For example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B label',
etc.))
Regards,
-Nathan
Just confirmed that this is impossible (or rather really hard to do).
Thanks Nathan and Yaw. In our current project we intend to get around by
making copying labels to values but this is pretty odd. Hope we will have a
better solution in the future.
Trung.
There is a pretty straightforward way to do this, actually. If you create
your select field using itemsets, this looks like
...
select from the followingNow anywhere in the app where you want to show the appropriate label for
the selected value in myanswer, you can just use
jr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has to
answer the question, since you can't run jr:itext with no value.
jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the user
is invisible to the backend engine. It's better to share the things you
want to use than to try to fetch them from the UI layer.
-Clayton
Thanks Nathan and Yaw. In our current project we intend to get around by
making copying labels to values but this is pretty odd. Hope we will have a
better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to do).
On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I can think
of
would be to make a formula with a bunch of nested "if" statements that
returns the label corresponding to the variable's value. For example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B
label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical) answer
instead
of value which we do like this ${variable}. I have done a bit of
research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.comopendatakit%2Bunsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=enhttp://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
Clayton is there a workaround for this in xls2forms?
Clayton,
Your itemset-based solution to fetching labels appears that it should work
with XLSForm -- provided that your option lists have a filter/choice_filter
column so that they are coded into the XML as itemsets.
The solution seems oriented, however, to select_one cases. Is there an
option to pull labels appropriately for select_multiple cases? For example,
you call selected-at() to fetch selection #x, then you want the label that
goes with that particular selection. Is there a way to do that via
jr:itext()?
I'd been planning to implement a selection-label() function to pull the
label associated with a current selection, but obviously I will only
implement that if there is no existing method. If there is an existing
method, then I can focus on finding a way to make it easy enough that it's
accessible to most (XLSForm) users.
Thanks very much,
Chris
There is a pretty straightforward way to do this, actually. If you create
value1 value2 .... ... value 1 label text
your select field using itemsets, this looks like...
select from the followingNow anywhere in the app where you want to show the appropriate label for
the selected value in myanswer, you can just usejr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has to
answer the question, since you can't run jr:itext with no value.jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the user
is invisible to the backend engine. It's better to share the things you
want to use than to try to fetch them from the UI layer.-Clayton
On Fri, Mar 23, 2012 at 4:36 PM, Trung Dang Le trungdangle@gmail.comwrote:
Thanks Nathan and Yaw. In our current project we intend to get around by
making copying labels to values but this is pretty odd. Hope we will have a
better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to do).
On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I can
think of
would be to make a formula with a bunch of nested "if" statements that
returns the label corresponding to the variable's value. For example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B
label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical) answer
instead
of value which we do like this ${variable}. I have done a bit of
research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
Hi Clayton,
Do you have a suggestion on how this can work where I am populating the choices via external itemset. jr:choice-name() does not seem to work in that case presumably since it is no longer a select1 when working with external itemsets.csv
I actually discovered the jr:choice-name() function, which seems to promise
the functionality that I and many others are after. However, when I try it
with a very simple static yes/no select_one, it always fails with a
NullPointerException on validation. It doesn't seem to matter much what I
pass it; it always seems to fail.
Has anybody had any luck with jr:choice-name()?
Thanks,
Chris
Clayton,
Your itemset-based solution to fetching labels appears that it should work
with XLSForm -- provided that your option lists have a filter/choice_filter
column so that they are coded into the XML as itemsets.The solution seems oriented, however, to select_one cases. Is there an
option to pull labels appropriately for select_multiple cases? For example,
you call selected-at() to fetch selection #x, then you want the label that
goes with that particular selection. Is there a way to do that via
jr:itext()?I'd been planning to implement a selection-label() function to pull the
label associated with a current selection, but obviously I will only
implement that if there is no existing method. If there is an existing
method, then I can focus on finding a way to make it easy enough that it's
accessible to most (XLSForm) users.Thanks very much,
Chris
On Mon, Mar 26, 2012 at 6:07 PM, Clayton Sims csims@dimagi.com wrote:
There is a pretty straightforward way to do this, actually. If you create
value1 value2 .... ... value 1 label text
your select field using itemsets, this looks like...
select from the followingNow anywhere in the app where you want to show the appropriate label for
the selected value in myanswer, you can just usejr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has to
answer the question, since you can't run jr:itext with no value.jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the user
is invisible to the backend engine. It's better to share the things you
want to use than to try to fetch them from the UI layer.-Clayton
On Fri, Mar 23, 2012 at 4:36 PM, Trung Dang Le trungdangle@gmail.comwrote:
Thanks Nathan and Yaw. In our current project we intend to get around by
making copying labels to values but this is pretty odd. Hope we will have a
better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to do).
On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I can
think of
would be to make a formula with a bunch of nested "if" statements that
returns the label corresponding to the variable's value. For example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B
label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical) answer
instead
of value which we do like this ${variable}. I have done a bit of
research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
I don't see that in the JR source tree. Is that perhaps an extension added
via a IFunctionHandler in whatever system you're looking at?
I actually discovered the jr:choice-name() function, which seems to
promise the functionality that I and many others are after. However, when I
try it with a very simple static yes/no select_one, it always fails with a
NullPointerException on validation. It doesn't seem to matter much what I
pass it; it always seems to fail.Has anybody had any luck with jr:choice-name()?
Thanks,
Chris
On Mon, Jun 17, 2013 at 8:44 AM, Christopher Robert <crobert@surveycto.com wrote:
Clayton,
Your itemset-based solution to fetching labels appears that it should
work with XLSForm -- provided that your option lists have a
filter/choice_filter column so that they are coded into the XML as itemsets.The solution seems oriented, however, to select_one cases. Is there an
option to pull labels appropriately for select_multiple cases? For example,
you call selected-at() to fetch selection #x, then you want the label that
goes with that particular selection. Is there a way to do that via
jr:itext()?I'd been planning to implement a selection-label() function to pull the
label associated with a current selection, but obviously I will only
implement that if there is no existing method. If there is an existing
method, then I can focus on finding a way to make it easy enough that it's
accessible to most (XLSForm) users.Thanks very much,
Chris
On Mon, Mar 26, 2012 at 6:07 PM, Clayton Sims csims@dimagi.com wrote:
There is a pretty straightforward way to do this, actually. If you
value1 value2 .... ... value 1 label text
create your select field using itemsets, this looks like...
select from the followingNow anywhere in the app where you want to show the appropriate label for
the selected value in myanswer, you can just usejr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has to
answer the question, since you can't run jr:itext with no value.jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the
user is invisible to the backend engine. It's better to share the things
you want to use than to try to fetch them from the UI layer.-Clayton
On Fri, Mar 23, 2012 at 4:36 PM, Trung Dang Le trungdangle@gmail.comwrote:
Thanks Nathan and Yaw. In our current project we intend to get around
by making copying labels to values but this is pretty odd. Hope we will
have a better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to do).
On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I can
think of
would be to make a formula with a bunch of nested "if" statements
that
returns the label corresponding to the variable's value. For example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B
label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical) answer
instead
of value which we do like this ${variable}. I have done a bit of
research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
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/groups/opt_out.
--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com
Mitch, I have to admit, for a brief moment I questioned my own sanity, and
wondered whether it was something I'd myself written. But no, see:
https://bitbucket.org/javarosa/javarosa/commits/24ed57dcff395ac1bc739b1058e7ce890761f224
It's also in the FormDef.java in your JavaRosa branch. It's just not at all
in the normal place for such things..!
Chris
I don't see that in the JR source tree. Is that perhaps an extension
added via a IFunctionHandler in whatever system you're looking at?On Fri, Jun 21, 2013 at 6:19 AM, Christopher Robert <crobert@surveycto.com wrote:
I actually discovered the jr:choice-name() function, which seems to
promise the functionality that I and many others are after. However, when I
try it with a very simple static yes/no select_one, it always fails with a
NullPointerException on validation. It doesn't seem to matter much what I
pass it; it always seems to fail.Has anybody had any luck with jr:choice-name()?
Thanks,
Chris
On Mon, Jun 17, 2013 at 8:44 AM, Christopher Robert < crobert@surveycto.com> wrote:
Clayton,
Your itemset-based solution to fetching labels appears that it should
work with XLSForm -- provided that your option lists have a
filter/choice_filter column so that they are coded into the XML as itemsets.The solution seems oriented, however, to select_one cases. Is there an
option to pull labels appropriately for select_multiple cases? For example,
you call selected-at() to fetch selection #x, then you want the label that
goes with that particular selection. Is there a way to do that via
jr:itext()?I'd been planning to implement a selection-label() function to pull the
label associated with a current selection, but obviously I will only
implement that if there is no existing method. If there is an existing
method, then I can focus on finding a way to make it easy enough that it's
accessible to most (XLSForm) users.Thanks very much,
Chris
On Mon, Mar 26, 2012 at 6:07 PM, Clayton Sims csims@dimagi.com wrote:
There is a pretty straightforward way to do this, actually. If you
value1 value2 .... ... value 1 label text
create your select field using itemsets, this looks like...
select from the followingNow anywhere in the app where you want to show the appropriate label
for the selected value in myanswer, you can just usejr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has to
answer the question, since you can't run jr:itext with no value.jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the
user is invisible to the backend engine. It's better to share the things
you want to use than to try to fetch them from the UI layer.-Clayton
On Fri, Mar 23, 2012 at 4:36 PM, Trung Dang Le trungdangle@gmail.comwrote:
Thanks Nathan and Yaw. In our current project we intend to get around
by making copying labels to values but this is pretty odd. Hope we will
have a better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to do).
On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I can
think of
would be to make a formula with a bunch of nested "if" statements
that
returns the label corresponding to the variable's value. For
example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B
label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical) answer
instead
of value which we do like this ${variable}. I have done a bit of
research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
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/groups/opt_out.--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com--
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/groups/opt_out.
Wow. OK. I never, ever, knew about this...
I've updated the documentation on the bindings page
with the usage information.
Mitch, I have to admit, for a brief moment I questioned my own sanity, and
wondered whether it was something I'd myself written. But no, see:https://bitbucket.org/javarosa/javarosa/commits/24ed57dcff395ac1bc739b1058e7ce890761f224
It's also in the FormDef.java in your JavaRosa branch. It's just not at
all in the normal place for such things..!Chris
On Fri, Jun 21, 2013 at 6:25 PM, Mitch Sundt mitchellsundt@gmail.comwrote:
I don't see that in the JR source tree. Is that perhaps an extension
added via a IFunctionHandler in whatever system you're looking at?On Fri, Jun 21, 2013 at 6:19 AM, Christopher Robert < crobert@surveycto.com> wrote:
I actually discovered the jr:choice-name() function, which seems to
promise the functionality that I and many others are after. However, when I
try it with a very simple static yes/no select_one, it always fails with a
NullPointerException on validation. It doesn't seem to matter much what I
pass it; it always seems to fail.Has anybody had any luck with jr:choice-name()?
Thanks,
Chris
On Mon, Jun 17, 2013 at 8:44 AM, Christopher Robert < crobert@surveycto.com> wrote:
Clayton,
Your itemset-based solution to fetching labels appears that it should
work with XLSForm -- provided that your option lists have a
filter/choice_filter column so that they are coded into the XML as itemsets.The solution seems oriented, however, to select_one cases. Is there an
option to pull labels appropriately for select_multiple cases? For example,
you call selected-at() to fetch selection #x, then you want the label that
goes with that particular selection. Is there a way to do that via
jr:itext()?I'd been planning to implement a selection-label() function to pull the
label associated with a current selection, but obviously I will only
implement that if there is no existing method. If there is an existing
method, then I can focus on finding a way to make it easy enough that it's
accessible to most (XLSForm) users.Thanks very much,
Chris
On Mon, Mar 26, 2012 at 6:07 PM, Clayton Sims csims@dimagi.com wrote:
There is a pretty straightforward way to do this, actually. If you
value1 value2 .... ... value 1 label text
create your select field using itemsets, this looks like...
select from the followingNow anywhere in the app where you want to show the appropriate label
for the selected value in myanswer, you can just usejr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has
to answer the question, since you can't run jr:itext with no value.jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the
user is invisible to the backend engine. It's better to share the things
you want to use than to try to fetch them from the UI layer.-Clayton
On Fri, Mar 23, 2012 at 4:36 PM, Trung Dang Le trungdangle@gmail.comwrote:
Thanks Nathan and Yaw. In our current project we intend to get around
by making copying labels to values but this is pretty odd. Hope we will
have a better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to do).
On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I can
think of
would be to make a formula with a bunch of nested "if" statements
that
returns the label corresponding to the variable's value. For
example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B
label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical) answer
instead
of value which we do like this ${variable}. I have done a bit of
research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
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/groups/opt_out.--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com--
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/groups/opt_out.--
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/groups/opt_out.
--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com
But, Mitch, two things:
There seems to be a NullPointerException whenever you try to pass a
jr:choice-name() through ODK_Validate.
The XPath in the second parameter has to be surrounded by quotes so that
it's passed in as a string, otherwise you get a "Parse error in XPath path"
exception.
I tested with a single and two languages (so with a very basic itemset
case). I'll see about fixing the NullPointerException so that it will work
via XLSForms (which have to pass through ODK_Validate). If you revise the
bindings page to have quotes around the XPath, then maybe we'll have a
solution.
Thanks,
Chris
Wow. OK. I never, ever, knew about this...
I've updated the documentation on the bindings page
http://opendatakit.org/help/form-design/binding/
with the usage information.On Fri, Jun 21, 2013 at 9:44 AM, Christopher Robert < chrislrobert@gmail.com> wrote:
Mitch, I have to admit, for a brief moment I questioned my own sanity,
and wondered whether it was something I'd myself written. But no, see:https://bitbucket.org/javarosa/javarosa/commits/24ed57dcff395ac1bc739b1058e7ce890761f224
It's also in the FormDef.java in your JavaRosa branch. It's just not at
all in the normal place for such things..!Chris
On Fri, Jun 21, 2013 at 6:25 PM, Mitch Sundt mitchellsundt@gmail.comwrote:
I don't see that in the JR source tree. Is that perhaps an extension
added via a IFunctionHandler in whatever system you're looking at?On Fri, Jun 21, 2013 at 6:19 AM, Christopher Robert < crobert@surveycto.com> wrote:
I actually discovered the jr:choice-name() function, which seems to
promise the functionality that I and many others are after. However, when I
try it with a very simple static yes/no select_one, it always fails with a
NullPointerException on validation. It doesn't seem to matter much what I
pass it; it always seems to fail.Has anybody had any luck with jr:choice-name()?
Thanks,
Chris
On Mon, Jun 17, 2013 at 8:44 AM, Christopher Robert < crobert@surveycto.com> wrote:
Clayton,
Your itemset-based solution to fetching labels appears that it should
work with XLSForm -- provided that your option lists have a
filter/choice_filter column so that they are coded into the XML as itemsets.The solution seems oriented, however, to select_one cases. Is there an
option to pull labels appropriately for select_multiple cases? For example,
you call selected-at() to fetch selection #x, then you want the label that
goes with that particular selection. Is there a way to do that via
jr:itext()?I'd been planning to implement a selection-label() function to pull
the label associated with a current selection, but obviously I will only
implement that if there is no existing method. If there is an existing
method, then I can focus on finding a way to make it easy enough that it's
accessible to most (XLSForm) users.Thanks very much,
Chris
On Mon, Mar 26, 2012 at 6:07 PM, Clayton Sims csims@dimagi.comwrote:
There is a pretty straightforward way to do this, actually. If you
value1 value2 .... ... value 1 label text
create your select field using itemsets, this looks like...
select from the followingNow anywhere in the app where you want to show the appropriate label
for the selected value in myanswer, you can just usejr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has
to answer the question, since you can't run jr:itext with no value.jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the
user is invisible to the backend engine. It's better to share the things
you want to use than to try to fetch them from the UI layer.-Clayton
On Fri, Mar 23, 2012 at 4:36 PM, Trung Dang Le <trungdangle@gmail.com wrote:
Thanks Nathan and Yaw. In our current project we intend to get
around by making copying labels to values but this is pretty odd. Hope we
will have a better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to
do).On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I can
think of
would be to make a formula with a bunch of nested "if" statements
that
returns the label corresponding to the variable's value. For
example:
if(${variable}='a_value', 'A label', if(${variable}='b_value', 'B
label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical)
answer instead
of value which we do like this ${variable}. I have done a bit of
research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
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/groups/opt_out.--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com--
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/groups/opt_out.--
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/groups/opt_out.--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com--
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/groups/opt_out.
I've filed https://code.google.com/p/opendatakit/issues/detail?id=854 with
a fix for the exception. Then I think that jr:choice-name() is actually
ready to use.
Thanks,
Chris
But, Mitch, two things:
There seems to be a NullPointerException whenever you try to pass a
jr:choice-name() through ODK_Validate.The XPath in the second parameter has to be surrounded by quotes so
that it's passed in as a string, otherwise you get a "Parse error in XPath
path" exception.I tested with a single and two languages (so with a very basic itemset
case). I'll see about fixing the NullPointerException so that it will work
via XLSForms (which have to pass through ODK_Validate). If you revise the
bindings page to have quotes around the XPath, then maybe we'll have a
solution.Thanks,
Chris
On Fri, Jun 21, 2013 at 10:02 PM, Mitch Sundt mitchellsundt@gmail.comwrote:
Wow. OK. I never, ever, knew about this...
I've updated the documentation on the bindings page
http://opendatakit.org/help/form-design/binding/
with the usage information.On Fri, Jun 21, 2013 at 9:44 AM, Christopher Robert < chrislrobert@gmail.com> wrote:
Mitch, I have to admit, for a brief moment I questioned my own sanity,
and wondered whether it was something I'd myself written. But no, see:https://bitbucket.org/javarosa/javarosa/commits/24ed57dcff395ac1bc739b1058e7ce890761f224
It's also in the FormDef.java in your JavaRosa branch. It's just not at
all in the normal place for such things..!Chris
On Fri, Jun 21, 2013 at 6:25 PM, Mitch Sundt mitchellsundt@gmail.comwrote:
I don't see that in the JR source tree. Is that perhaps an extension
added via a IFunctionHandler in whatever system you're looking at?On Fri, Jun 21, 2013 at 6:19 AM, Christopher Robert < crobert@surveycto.com> wrote:
I actually discovered the jr:choice-name() function, which seems to
promise the functionality that I and many others are after. However, when I
try it with a very simple static yes/no select_one, it always fails with a
NullPointerException on validation. It doesn't seem to matter much what I
pass it; it always seems to fail.Has anybody had any luck with jr:choice-name()?
Thanks,
Chris
On Mon, Jun 17, 2013 at 8:44 AM, Christopher Robert < crobert@surveycto.com> wrote:
Clayton,
Your itemset-based solution to fetching labels appears that it should
work with XLSForm -- provided that your option lists have a
filter/choice_filter column so that they are coded into the XML as itemsets.The solution seems oriented, however, to select_one cases. Is there
an option to pull labels appropriately for select_multiple cases? For
example, you call selected-at() to fetch selection #x, then you want the
label that goes with that particular selection. Is there a way to do that
via jr:itext()?I'd been planning to implement a selection-label() function to pull
the label associated with a current selection, but obviously I will only
implement that if there is no existing method. If there is an existing
method, then I can focus on finding a way to make it easy enough that it's
accessible to most (XLSForm) users.Thanks very much,
Chris
On Mon, Mar 26, 2012 at 6:07 PM, Clayton Sims csims@dimagi.comwrote:
There is a pretty straightforward way to do this, actually. If you
value1 value2 .... ... value 1 label text
create your select field using itemsets, this looks like...
select from the followingNow anywhere in the app where you want to show the appropriate label
for the selected value in myanswer, you can just usejr:itext(/data/myanswer)
the only thing to be careful of is that you ensure that the user has
to answer the question, since you can't run jr:itext with no value.jr:itext(coalesce(/data/myanswer,'somedefaultlabel'))
would address that, even.
It's important to remember that in xforms the layer presented to the
user is invisible to the backend engine. It's better to share the things
you want to use than to try to fetch them from the UI layer.-Clayton
On Fri, Mar 23, 2012 at 4:36 PM, Trung Dang Le < trungdangle@gmail.com> wrote:
Thanks Nathan and Yaw. In our current project we intend to get
around by making copying labels to values but this is pretty odd. Hope we
will have a better solution in the future.Trung.
On Friday, March 23, 2012 8:06:43 PM UTC+1, Yaw Anokwa wrote:
Just confirmed that this is impossible (or rather really hard to
do).On Tue, Mar 20, 2012 at 09:50, Nathan nabreit@gmail.com wrote:
I don't think there is an easy way to do this. The only way I
can think of
would be to make a formula with a bunch of nested "if"
statements that
returns the label corresponding to the variable's value. For
example:
if(${variable}='a_value', 'A label', if(${variable}='b_value',
'B label',
etc.))
Regards,
-NathanOn Sunday, March 18, 2012 8:38:50 PM UTC-7, Trung Dang Le wrote:
Hi all,
I would like to reference to the label of an (categorical)
answer instead
of value which we do like this ${variable}. I have done a bit
of research
but I've not found a clue.Does anyway have a solution?
Thanks.
Trugn--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en--
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/groups/opt_out.--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com--
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/groups/opt_out.--
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/groups/opt_out.--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com--
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/groups/opt_out.
Is there a solution to this problem now for a select_multiple question in a multilingual survey?
Exactly what the first poster in this thread wrote... "I would like to reference to the label of an (categorical) answer instead of value which we do like this ${variable}". I have since figured it out. Thanks.
For others looking for the solution, it's to use jr:choice-name(). More at https://docs.getodk.org/form-operators-functions/#jr:choice-name.