I tried this a while back and don't think this is possible with
position(). You'll probably need the preceding-sibling:: XPath axis for
that (e.g.* *count(../preceding-sibling::child) ), which I believe is
not supported in the ODK libraries. It does work in enketohttp://enketo.org/formtesterbut since it does not pass ODK Validate you'd have to somehow bypass this
(and no idea if that would cause other issues).
If you do find a way, please report back!
On Wednesday, March 6, 2013 1:07:56 PM UTC-7, Koen wrote:
Hi Mitch,
Thanks for your help. To be honest I have (virtually) no idea what I'm
doing within the XML file: I use XLSForm.
I've tried the following things;
To report the current position I have included a calculate in the repeat
group: position()
This doesn't quite work; it never gives me an error, but just reports 1
for every occurence (repeat index?). Not sure why.
Then I tried to extract some info from the repeat group. This could be
useful for a number of things. Hasn't worked. This is mostly because
XLSForm tries to translate things to xpath for me I think. If I do
something of the sort:
/household_rostrer[postion() = 1]/age
I will try toying around with xml when I get to work tomorrow, but if you
know more and are willing to share, thanks! The first thing is my main
problem I suppose. I can get around the second issue by not including any
things I want to refer to later in repeats. (I am currently using it for
names only, and prefer to record them first anyway.)
Koen
Op woensdag 6 maart 2013 20:02:25 UTC+1 schreef Mitch het volgende:
Within XPath expressions, position() sort-of gives you the repeat position
of the current record (this acts like @position, but that doesn't work in
javarosa). Read up on XPath expressions to understand how position()
differs from the repeat index (i.e., due to filtering).
Often, you can use relative references to get at values that you need, so
you often don't need to know the index of the item you're on.
It may also be that the tools available ( Build / XLSForm ) do not give
you the ability to express what you want. The underlying XForms are more
powerful, but far more difficult to work with.
Mitch
On Wed, Mar 6, 2013 at 4:46 AM, Koen koen.l...@gmail.com wrote:
Hi,
I am sure this has been asked before, but I can't seem to find it,
possibly because I do not know the correct words to describe the issue. I
have been using CSPro, in which this would be described as an occurence
number.
Anyway: I am setting up a household questionnaire, which includes a
household roster. Before the household questionnaire I have added twenty
questions that ask for the name of each household member (I will do the
survey in Africa, 20 member households exist). I can refer to these names
later in later questions, which is great. Instead of asking for the
household member id I can just display the name. However, I would like to
be able to refer to these names from within the household roster. For
example: "How old is ${hh_member_nm_1}?" For this to work I would have to
know what occurence of the household roster I am in. After that, I would
still need to find a way to properly refer to the proper name:
hh_member_nm_1 the first time etc, but could just code 20 notes with a
relevance set to just one household member, so that'll work just fine.
Any ideas? If all else fails we could just use little pen and paper
notebooks to keep track of this, but the whole point was to eliminate
paper!
Thanks!
Koen
P.S. The whole thing with the 20 names I just came up with because it
seems I can not refer to hh_roster_name[1] in answer list, while I can
easily refer to answer values like ${hh_member_nm_1}. If this is mistaken,
then my whole problem would also just disappear.
--
Post: opend...@googlegroups.com
Unsubscribe: opendatakit...@googlegroups.**com
Options: http://groups.google.com/**group/opendatakit?hl=enhttp://groups.google.com/group/opendatakit?hl=en
You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubs
--
Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@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 <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>.
For more options, visit https://groups.google.com/groups/opt_out.