How do I list the line number (repeat number) within a repeat group?

Hi all,
I believe this question might have been asked before, (
https://groups.google.com/forum/?fromgroups#!searchin/opendatakit/repeat|sort:date/opendatakit/Q60Af96eXJA/J9aY4B5cRZMJ
) but I can not get anything to work.
I would like to refer to the line number or repeat number for iteration
ofquestions so that the interviewers don't get too confused when entering a
lot of information in a repeat group.
I tried this, but it sucks:

type

name

label

repeat_count

calculation

integer

supervisuers_count

How many supervisors will you enter information for

begin repeat

supervisuersr

../supervisuers_count

begin group

superviseurs

Supervisors

calculate

position

Line number

position(..)

text

superviseurname_text

Name of Supervisor # ${position}

text

superviseurfuction_text

Position of Supervisor # ${position}

end group

end repeat

Could anyone give me a hint?

Thanks!
Bill

1 Like

Bill,

The more specific you are about what's going wrong, the more specific we
can be about possible solutions. Your use of position(..) looks right to
me. Your repeat_count should probably just be "${supervisuers_count}"
(without the quotes). Otherwise, be sure you're running the latest version
of Collect; older versions didn't support position(..). And again, the more
specific you can be, the better.

Best,

Chris

··· On Mon, Nov 25, 2013 at 8:13 AM, Bill Olander wrote:

Hi all,
I believe this question might have been asked before, (
https://groups.google.com/forum/?fromgroups#!searchin/opendatakit/repeat|sort:date/opendatakit/Q60Af96eXJA/J9aY4B5cRZMJ
) but I can not get anything to work.
I would like to refer to the line number or repeat number for iteration
ofquestions so that the interviewers don't get too confused when entering a
lot of information in a repeat group.
I tried this, but it sucks:

type

name

label

repeat_count

calculation

integer

supervisuers_count

How many supervisors will you enter information for

begin repeat

supervisuersr

../supervisuers_count

begin group

superviseurs

Supervisors

calculate

position

Line number

position(..)

text

superviseurname_text

Name of Supervisor # ${position}

text

superviseurfuction_text

Position of Supervisor # ${position}

end group

end repeat

Could anyone give me a hint?

Thanks!
Bill

--

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.

Hi Chris,
Thanks for replying.
The trouble I'm having is that it doesn't seem to refresh for each
repeat. When running the first iteration of the repeat I get:
Name of Supervisor # 1
Position of Supervisor # 1
that's great, but for the next iteration of the repeat also appears as:
Name of Supervisor # 1
Position of Supervisor # 1
I changed the repeat count to ${} instead of /.. and I double checked I'm
using 1.4. Any ideas?
Thanks again,
Bill

··· On Monday, November 25, 2013 3:44:42 PM UTC, Christopher Robert wrote: > > Bill, > > The more specific you are about what's going wrong, the more specific we > can be about possible solutions. Your use of position(..) looks right to > me. Your repeat_count should probably just be "${supervisuers_count}" > (without the quotes). Otherwise, be sure you're running the latest version > of Collect; older versions didn't support position(..). And again, the more > specific you can be, the better. > > Best, > > Chris > > > > On Mon, Nov 25, 2013 at 8:13 AM, Bill Olander <billyo...@gmail.com wrote: > >> Hi all, >> I believe this question might have been asked before, ( >> https://groups.google.com/forum/?fromgroups#!searchin/opendatakit/repeat%7Csort:date/opendatakit/Q60Af96eXJA/J9aY4B5cRZMJ >> ) but I can not get anything to work. >> I would like to refer to the line number or repeat number for >> iteration ofquestions so that the interviewers don't get too confused when >> entering a lot of information in a repeat group. >> I tried this, but it sucks: >> >> type >> >> name >> >> label >> >> repeat_count >> >> calculation >> >> integer >> >> supervisuers_count >> >> How many supervisors will you enter information for >> >> >> >> >> >> begin repeat >> >> supervisuersr >> >> >> >> ../supervisuers_count >> >> >> >> begin group >> >> superviseurs >> >> Supervisors >> >> >> >> >> >> calculate >> >> position >> >> Line number >> >> >> >> position(..) >> >> text >> >> superviseurname_text >> >> Name of Supervisor # ${position} >> >> >> >> >> >> text >> >> superviseurfuction_text >> >> Position of Supervisor # ${position} >> >> >> >> >> >> end group >> >> >> >> >> >> >> >> >> >> end repeat >> >> >> >> >> >> >> >> >> Could anyone give me a hint? >> Thanks! >> Bill >> >> -- >> -- >> 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/groups/opt_out. >> > >

Hi Bill,

I am not sure why it's not working, but I have two suggestions:

  1. Rename your field "pos" or something not to conflict with the function
    name. Your existing name is probably fine, but it's always a gamble to name
    something in a way that might conflict with a built-in function.

  2. Move your "pos" field to be between the "begin repeat" and the "begin
    group", so that it's directly inside the repeat rather than inside another
    group inside the repeat. It could be that the position you're getting is
    relative to that inner group somehow.

Best,

Chris

··· On Tue, Nov 26, 2013 at 5:20 AM, Bill Olander wrote:

Hi Chris,
Thanks for replying.
The trouble I'm having is that it doesn't seem to refresh for each
repeat. When running the first iteration of the repeat I get:
Name of Supervisor # 1
Position of Supervisor # 1
that's great, but for the next iteration of the repeat also appears as:
Name of Supervisor # 1
Position of Supervisor # 1
I changed the repeat count to ${} instead of /.. and I double checked
I'm using 1.4. Any ideas?
Thanks again,
Bill

On Monday, November 25, 2013 3:44:42 PM UTC, Christopher Robert wrote:

Bill,

The more specific you are about what's going wrong, the more specific we
can be about possible solutions. Your use of position(..) looks right to
me. Your repeat_count should probably just be "${supervisuers_count}"
(without the quotes). Otherwise, be sure you're running the latest version
of Collect; older versions didn't support position(..). And again, the more
specific you can be, the better.

Best,

Chris

On Mon, Nov 25, 2013 at 8:13 AM, Bill Olander billyo...@gmail.comwrote:

Hi all,
I believe this question might have been asked before, (
https://groups.google.com/forum/?fromgroups#!searchin/
opendatakit/repeat%7Csort:date/opendatakit/Q60Af96eXJA/J9aY4B5cRZMJ) but
I can not get anything to work.
I would like to refer to the line number or repeat number for
iteration ofquestions so that the interviewers don't get too confused when
entering a lot of information in a repeat group.
I tried this, but it sucks:

type

name

label

repeat_count

calculation

integer

supervisuers_count

How many supervisors will you enter information for

begin repeat

supervisuersr

../supervisuers_count

begin group

superviseurs

Supervisors

calculate

position

Line number

position(..)

text

superviseurname_text

Name of Supervisor # ${position}

text

superviseurfuction_text

Position of Supervisor # ${position}

end group

end repeat

Could anyone give me a hint?

Thanks!
Bill

--

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

BOOOM!

Putting the calculate between the repeat and the group did the trick.
Thanks, Chris!

··· On Tuesday, November 26, 2013 11:48:02 AM UTC, Christopher Robert wrote: > > Hi Bill, > > I am not sure why it's not working, but I have two suggestions: > > 1. Rename your field "pos" or something not to conflict with the function > name. Your existing name is probably fine, but it's always a gamble to name > something in a way that might conflict with a built-in function. > > 2. Move your "pos" field to be between the "begin repeat" and the "begin > group", so that it's directly inside the repeat rather than inside another > group inside the repeat. It could be that the position you're getting is > relative to that inner group somehow. > > Best, > > Chris > > > > On Tue, Nov 26, 2013 at 5:20 AM, Bill Olander <billyo...@gmail.com wrote: > >> Hi Chris, >> Thanks for replying. >> The trouble I'm having is that it doesn't seem to refresh for each >> repeat. When running the first iteration of the repeat I get: >> Name of Supervisor # 1 >> Position of Supervisor # 1 >> that's great, but for the next iteration of the repeat also appears >> as: >> Name of Supervisor # 1 >> Position of Supervisor # 1 >> I changed the repeat count to ${} instead of /.. and I double checked >> I'm using 1.4. Any ideas? >> Thanks again, >> Bill >> >> >> On Monday, November 25, 2013 3:44:42 PM UTC, Christopher Robert wrote: >> >>> Bill, >>> >>> The more specific you are about what's going wrong, the more specific we >>> can be about possible solutions. Your use of position(..) looks right to >>> me. Your repeat_count should probably just be "${supervisuers_count}" >>> (without the quotes). Otherwise, be sure you're running the latest version >>> of Collect; older versions didn't support position(..). And again, the more >>> specific you can be, the better. >>> >>> Best, >>> >>> Chris >>> >>> >>> >>> On Mon, Nov 25, 2013 at 8:13 AM, Bill Olander wrote: >>> >>>> Hi all, >>>> I believe this question might have been asked before, ( >>>> https://groups.google.com/forum/?fromgroups#!searchin/ >>>> opendatakit/repeat%7Csort:date/opendatakit/Q60Af96eXJA/J9aY4B5cRZMJ) but >>>> I can not get anything to work. >>>> I would like to refer to the line number or repeat number for >>>> iteration ofquestions so that the interviewers don't get too confused when >>>> entering a lot of information in a repeat group. >>>> I tried this, but it sucks: >>>> >>>> type >>>> >>>> name >>>> >>>> label >>>> >>>> repeat_count >>>> >>>> calculation >>>> >>>> integer >>>> >>>> supervisuers_count >>>> >>>> How many supervisors will you enter information for >>>> >>>> >>>> >>>> >>>> >>>> begin repeat >>>> >>>> supervisuersr >>>> >>>> >>>> >>>> ../supervisuers_count >>>> >>>> >>>> >>>> begin group >>>> >>>> superviseurs >>>> >>>> Supervisors >>>> >>>> >>>> >>>> >>>> >>>> calculate >>>> >>>> position >>>> >>>> Line number >>>> >>>> >>>> >>>> position(..) >>>> >>>> text >>>> >>>> superviseurname_text >>>> >>>> Name of Supervisor # ${position} >>>> >>>> >>>> >>>> >>>> >>>> text >>>> >>>> superviseurfuction_text >>>> >>>> Position of Supervisor # ${position} >>>> >>>> >>>> >>>> >>>> >>>> end group >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> end repeat >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> Could anyone give me a hint? >>>> Thanks! >>>> Bill >>>> >>>> -- >>>> -- >>>> 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/groups/opt_out. >>>> >>> >>> -- >> -- >> 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/groups/opt_out. >> > >
1 Like

Great! Glad to hear that it worked.

And, that's something good for us to document. I didn't realize that
position(..) was sensitive to non-repeating groups.

Best,

Chris

··· On Tue, Nov 26, 2013 at 11:45 AM, Bill Olander wrote:

BOOOM!

Putting the calculate between the repeat and the group did the trick.
Thanks, Chris!

On Tuesday, November 26, 2013 11:48:02 AM UTC, Christopher Robert wrote:

Hi Bill,

I am not sure why it's not working, but I have two suggestions:

  1. Rename your field "pos" or something not to conflict with the function
    name. Your existing name is probably fine, but it's always a gamble to name
    something in a way that might conflict with a built-in function.

  2. Move your "pos" field to be between the "begin repeat" and the "begin
    group", so that it's directly inside the repeat rather than inside another
    group inside the repeat. It could be that the position you're getting is
    relative to that inner group somehow.

Best,

Chris

On Tue, Nov 26, 2013 at 5:20 AM, Bill Olander billyo...@gmail.comwrote:

Hi Chris,
Thanks for replying.
The trouble I'm having is that it doesn't seem to refresh for each
repeat. When running the first iteration of the repeat I get:
Name of Supervisor # 1
Position of Supervisor # 1
that's great, but for the next iteration of the repeat also appears
as:
Name of Supervisor # 1
Position of Supervisor # 1
I changed the repeat count to ${} instead of /.. and I double checked
I'm using 1.4. Any ideas?
Thanks again,
Bill

On Monday, November 25, 2013 3:44:42 PM UTC, Christopher Robert wrote:

Bill,

The more specific you are about what's going wrong, the more specific
we can be about possible solutions. Your use of position(..) looks right to
me. Your repeat_count should probably just be "${supervisuers_count}"
(without the quotes). Otherwise, be sure you're running the latest version
of Collect; older versions didn't support position(..). And again, the more
specific you can be, the better.

Best,

Chris

On Mon, Nov 25, 2013 at 8:13 AM, Bill Olander billyo...@gmail.comwrote:

Hi all,
I believe this question might have been asked before, (
https://groups.google.com/forum/?fromgroups#!searchin/opend
atakit/repeat%7Csort:date/opendatakit/Q60Af96eXJA/J9aY4B5cRZMJ) but I
can not get anything to work.
I would like to refer to the line number or repeat number for
iteration ofquestions so that the interviewers don't get too confused when
entering a lot of information in a repeat group.
I tried this, but it sucks:

type

name

label

repeat_count

calculation

integer

supervisuers_count

How many supervisors will you enter information for

begin repeat

supervisuersr

../supervisuers_count

begin group

superviseurs

Supervisors

calculate

position

Line number

position(..)

text

superviseurname_text

Name of Supervisor # ${position}

text

superviseurfuction_text

Position of Supervisor # ${position}

end group

end repeat

Could anyone give me a hint?

Thanks!
Bill

--

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/groups/opt_out.

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

I also hadn't put 2 & 2 together.

But, since '..' is just an XPath expression, it makes sense that either
putting the calculate outside the nested group or using position(../..)
would be required.

··· On Tue, Nov 26, 2013 at 8:47 AM, Christopher Robert wrote:

Great! Glad to hear that it worked.

And, that's something good for us to document. I didn't realize that
position(..) was sensitive to non-repeating groups.

Best,

Chris

On Tue, Nov 26, 2013 at 11:45 AM, Bill Olander billyolander@gmail.comwrote:

BOOOM!

Putting the calculate between the repeat and the group did the trick.
Thanks, Chris!

On Tuesday, November 26, 2013 11:48:02 AM UTC, Christopher Robert wrote:

Hi Bill,

I am not sure why it's not working, but I have two suggestions:

  1. Rename your field "pos" or something not to conflict with the
    function name. Your existing name is probably fine, but it's always a
    gamble to name something in a way that might conflict with a built-in
    function.

  2. Move your "pos" field to be between the "begin repeat" and the "begin
    group", so that it's directly inside the repeat rather than inside another
    group inside the repeat. It could be that the position you're getting is
    relative to that inner group somehow.

Best,

Chris

On Tue, Nov 26, 2013 at 5:20 AM, Bill Olander billyo...@gmail.comwrote:

Hi Chris,
Thanks for replying.
The trouble I'm having is that it doesn't seem to refresh for each
repeat. When running the first iteration of the repeat I get:
Name of Supervisor # 1
Position of Supervisor # 1
that's great, but for the next iteration of the repeat also appears
as:
Name of Supervisor # 1
Position of Supervisor # 1
I changed the repeat count to ${} instead of /.. and I double checked
I'm using 1.4. Any ideas?
Thanks again,
Bill

On Monday, November 25, 2013 3:44:42 PM UTC, Christopher Robert wrote:

Bill,

The more specific you are about what's going wrong, the more specific
we can be about possible solutions. Your use of position(..) looks right to
me. Your repeat_count should probably just be "${supervisuers_count}"
(without the quotes). Otherwise, be sure you're running the latest version
of Collect; older versions didn't support position(..). And again, the more
specific you can be, the better.

Best,

Chris

On Mon, Nov 25, 2013 at 8:13 AM, Bill Olander billyo...@gmail.comwrote:

Hi all,
I believe this question might have been asked before, (
https://groups.google.com/forum/?fromgroups#!searchin/opend
atakit/repeat%7Csort:date/opendatakit/Q60Af96eXJA/J9aY4B5cRZMJ) but
I can not get anything to work.
I would like to refer to the line number or repeat number for
iteration ofquestions so that the interviewers don't get too confused when
entering a lot of information in a repeat group.
I tried this, but it sucks:

type

name

label

repeat_count

calculation

integer

supervisuers_count

How many supervisors will you enter information for

begin repeat

supervisuersr

../supervisuers_count

begin group

superviseurs

Supervisors

calculate

position

Line number

position(..)

text

superviseurname_text

Name of Supervisor # ${position}

text

superviseurfuction_text

Position of Supervisor # ${position}

end group

end repeat

Could anyone give me a hint?

Thanks!
Bill

--

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/groups/opt_out.

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

--

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

Hello, is this thread still open? i have the same problem of bill.

my question is it possible to count the data from the csv file? here's my example

type name label appearance repeat_count
select_multiple machine hhmach_type name of machines search('machinedetails')
begin_repeat machine_repeat info each machine ${hhmach_type}

i got an error message java.lang.string cannot be cast java.lang.integer so
I tried to use int(${hhmach_type}) in repeat_count but the begin_repeat doesnt show.

i hope u can help me. thank you in advance.

regards,
evan

hi @vans28 are you able to post your xlsform here? or can you use ASCII table on your different form worksheets and wrap the output in ``` before and after to make it show up like:

+---------+---------+
|  Col1   |  Col2   |
+---------+---------+
| Value 1 | Value 2 |
+---------+---------+

hi dan,

thanks for the reply btw here's my table.

* +------------------------------+-----------------+--------------------+--------------------------+---------------------------------------------------------------+---------------------+
* |             type             |      name       |       label        |        appearance        |                          relevance                            |    repeat_count     |
* +------------------------------+-----------------+--------------------+--------------------------+---------------------------------------------------------------+---------------------+
* |  select_multiple machine     | hhmach_type     | name of machines   | search(‘machinedetails’) |                                                               |                     |
* | begin_repeat                 |  machine_repeat |  info each machine |                          |                                                               | int(${hhmach_type}) |
* | select_one type_of_harvester | tharvester      | type of harvester  |                          | selected(${hhmach_type}, ‘1’) or selected(${hhmach_type},‘2’) |                     |
* +------------------------------+-----------------+--------------------+--------------------------+---------------------------------------------------------------+---------------------+

and here's the data of my csv file

+------------+---------------------+-----------+---------+---------+--------+
| hhmach_key |       machine       | machineid |  brand  | brandid | model  |
+------------+---------------------+-----------+---------+---------+--------+
|      20001 | two Wheel Tractor   |         1 | Agrindo |       1 | TA3504 |
|      20002 | three Wheel Tractor |         2 | Agrindo |       1 | TA3704 |
|      20003 | Four Wheel Tractor  |         3 | Agrindo |       1 | TA3304 |
+------------+---------------------+-----------+---------+---------+--------+

I just wanted to ask if the odk is capable counting the number of what i choose and make a begin repeat function?

thank you again.

Hi, Thanks for sharing this!
Putting the calculate between the repeat and the group is great!

1 Like