Count unique instances in repeat group

Hi all,

I'm trying to set up a calculation that gives me the number/count of a possible entry into a string field across repeat groups. Can anybody share the proper xlsform language to do this?

Thanks!

[attached is example .xls]

fh_experiment_book_6.xlsx (13.3 KB)

Can't think of a good way to do this for an arbitrary number of
repeats. You could use index-repeated to count up to a fixed number of
repeats that have the value you want.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Sat, Jul 26, 2014 at 10:57 PM, igardner@tns.org wrote:

Hi all,

I'm trying to set up a calculation that gives me the number/count of a possible entry into a string field across repeat groups. Can anybody share the proper xlsform language to do this?

Thanks!

[attached is example .xls]

--

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.

One trick I've seen used a lot is to have an if(some condition, 1, 0)
inside the repeat, then take a sum() outside the repeat. That will give you
a count of the number of times the condition was true inside the repeat.
Not sure if that works in this case, but it might.

Best,

Chris

··· On Mon, Jul 28, 2014 at 9:09 AM, Yaw Anokwa wrote:

Can't think of a good way to do this for an arbitrary number of
repeats. You could use index-repeated to count up to a fixed number of
repeats that have the value you want.

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Sat, Jul 26, 2014 at 10:57 PM, igardner@tns.org wrote:

Hi all,

I'm trying to set up a calculation that gives me the number/count of a
possible entry into a string field across repeat groups. Can anybody share
the proper xlsform language to do this?

Thanks!

[attached is example .xls]

--

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.

--

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.

I'm having a similar problem. What command do I use inside what field of XLSForm to be able to count the number of times a condition was true inside a repeat? I've tried everything I can think of and am at a loss... Please help!

Best,
Jacquie

··· On Monday, July 28, 2014 at 9:13:08 AM UTC-4, Christopher Robert wrote: > One trick I've seen used a lot is to have an if(some condition, 1, 0) inside the repeat, then take a sum() outside the repeat. That will give you a count of the number of times the condition was true inside the repeat. Not sure if that works in this case, but it might. > > > > > Best, > > > Chris > > > > > > On Mon, Jul 28, 2014 at 9:09 AM, Yaw Anokwa wrote: > > > Can't think of a good way to do this for an arbitrary number of > > repeats. You could use index-repeated to count up to a fixed number of > > repeats that have the value you want. > > > > Yaw > > -- > > Need ODK services? http://nafundi.com provides form design, server > > setup, professional support, and software development for ODK. > > > > > > > > On Sat, Jul 26, 2014 at 10:57 PM, wrote: > > > Hi all, > > > > > > I'm trying to set up a calculation that gives me the number/count of a possible entry into a string field across repeat groups. Can anybody share the proper xlsform language to do this? > > > > > > Thanks! > > > > > > [attached is example .xls] > > > > > > -- > > > -- > > > 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. > > > > -- > > -- > > 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.

Hi,
Suppose that you want to count a number of women in a family. Each repeat
stands for a member and you ask for each member his sex.

  1. you have to create a calculed variable cond1
  2. put in the calculation column this formula: if(sex='2',1,0). We assume
    that the value label of sex means woman .
  3. after the repeat group, you calculate and another variable cond2 and on
    its calculation column you put this formula:sum(${cond1})
    Try this
··· On Jun 24, 2015 1:06 PM, wrote:

I'm having a similar problem. What command do I use inside what field of
XLSForm to be able to count the number of times a condition was true inside
a repeat? I've tried everything I can think of and am at a loss... Please
help!

Best,
Jacquie

On Monday, July 28, 2014 at 9:13:08 AM UTC-4, Christopher Robert wrote:

One trick I've seen used a lot is to have an if(some condition, 1, 0)
inside the repeat, then take a sum() outside the repeat. That will give you
a count of the number of times the condition was true inside the repeat.
Not sure if that works in this case, but it might.

Best,

Chris

On Mon, Jul 28, 2014 at 9:09 AM, Yaw Anokwa yan...@nafundi.com wrote:

Can't think of a good way to do this for an arbitrary number of

repeats. You could use index-repeated to count up to a fixed number of

repeats that have the value you want.

Yaw

--

Need ODK services? http://nafundi.com provides form design, server

setup, professional support, and software development for ODK.

On Sat, Jul 26, 2014 at 10:57 PM, igar...@tns.org wrote:

Hi all,

I'm trying to set up a calculation that gives me the number/count of a
possible entry into a string field across repeat groups. Can anybody share
the proper xlsform language to do this?

Thanks!

[attached is example .xls]

--

--

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.

--

--

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.

--

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.

Hi all,
This has worked for me,
count(${Name of the repeat}[condition based on a field]). I used this for counting how many households are below 18 years, this was done out of the repeat, and the group in which that repeat was.
count(${DC}[age< 18])