# Ideas on creating calculation to summarize number of categories from repeat group

Hi all,
I'm trying to ask a question within a repeat group:

What category does this person belong to?

1. a
2. b
3. c
4. d

After closing the repeat group, I'd like to create variable's counting the
number of each category on the main table:
Number of category a:
Number of category b:
and so on

I'm feeling a little dumb. Could anyway donate their thoughts on how
they would do this expression/calculation?

Thanks!
Bill

If you have a repeat group 'rpt', with the category selection question 'q1'
:

/data/rpt/q1

Then you should be able to do something like

count(/data/rpt[q1='a'])

to get the count of category a selections

etc.

Things are much more difficult if you have a multiple-choice selection.
I'll leave that to you...

The available functions are http://opendatakit.org/help/form-design/binding/

Note that select-one and select-multiple values are always strings, so even
if the string values for the selection choices are entirely digits, you
will need to convert them to numbers should you want to do any calculations
with them.

Mitch

··· On Mon, Apr 28, 2014 at 4:09 AM, Bill Olander wrote:

Hi all,
I'm trying to ask a question within a repeat group:

What category does this person belong to?

1. a
2. b
3. c
4. d

After closing the repeat group, I'd like to create variable's counting the
number of each category on the main table:
Number of category a:
Number of category b:
and so on

I'm feeling a little dumb. Could anyway donate their thoughts on how
they would do this expression/calculation?

Thanks!
Bill

## --

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

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thanks Mitch!

Despite the very clear answer, I can't get this to work and my calculation
always returns a zero. Could ask you or any other kind soul to take a look
at my xls and tell me what I'm being stupid about:

Type

Name

label

Repeat_count

calculation

begin repeat

superviseesr

\${supervisees_count}

calculate

position2

Line number

position(..)

begin group

supervisees

PERSONNES SUPERVISEES :

text

superviseenom

Prenoms et Nom de Supervisees #\${position2} *

text

superviseefunction

Function de Supervisee #\${position2} *

select_one supgroup

superviseefunctiongrp

Catégorie de Supervisee #\${position2} *

end group

end repeat

calculate

superviseecnt1

Count of Consultation Externe

count(/data/superviseesr[superviseefunctiongrp='Consultation Externe'])

note

superviseecnt1note

Count of Consultation Externe: \${superviseecnt1}

where my choices look like this:

supgroup

1

Consultation Externe

supgroup

2

Médecine

supgroup

3

supgroup

4

Hospitalisation Pédiatrie

supgroup

5

Maternité

supgroup

6

Depositaire

supgroup

7

Autre

Thank you!

··· On Monday, April 28, 2014 6:35:03 PM UTC+1, Mitch Sundt wrote: > > If you have a repeat group 'rpt', with the category selection question > 'q1' : > > /data/rpt/q1 > > Then you should be able to do something like > > count(/data/rpt[q1='a']) > > to get the count of category a selections > > etc. > > Things are much more difficult if you have a multiple-choice selection. > I'll leave that to you... > > The available functions are > http://opendatakit.org/help/form-design/binding/ > > Note that select-one and select-multiple values are always strings, so > even if the string values for the selection choices are entirely digits, > you will need to convert them to numbers should you want to do any > calculations with them. > > Mitch > > > > On Mon, Apr 28, 2014 at 4:09 AM, Bill Olander <billyo...@gmail.com wrote: > >> Hi all, >> I'm trying to ask a question within a repeat group: >> >> What category does this person belong to? >> 1. a >> 2. b >> 3. c >> 4. d >> >> After closing the repeat group, I'd like to create variable's counting >> the number of each category on the main table: >> Number of category a: >> Number of category b: >> and so on >> >> I'm feeling a little dumb. Could anyway donate their thoughts on how >> they would do this expression/calculation? >> >> 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/d/optout. >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

Hi

You need to count the variable not the label assigned to that variable. So

count(/data/superviseesr[superviseefunctiongrp='1'])

Regards

··· On Tue, Apr 29, 2014 at 12:26 PM, Bill Olander wrote:

Thanks Mitch!

Despite the very clear answer, I can't get this to work and my calculation
always returns a zero. Could ask you or any other kind soul to take a look
at my xls and tell me what I'm being stupid about:

Type

Name

label

Repeat_count

calculation

begin repeat

superviseesr

\${supervisees_count}

calculate

position2

Line number

position(..)

begin group

supervisees

PERSONNES SUPERVISEES :

text

superviseenom

Prenoms et Nom de Supervisees #\${position2} *

text

superviseefunction

Function de Supervisee #\${position2} *

select_one supgroup

superviseefunctiongrp

Catégorie de Supervisee #\${position2} *

end group

end repeat

calculate

superviseecnt1

Count of Consultation Externe

count(/data/superviseesr[superviseefunctiongrp='Consultation Externe'])

note

superviseecnt1note

Count of Consultation Externe: \${superviseecnt1}

where my choices look like this:

supgroup

1

Consultation Externe

supgroup

2

Médecine

supgroup

3

supgroup

4

Hospitalisation Pédiatrie

supgroup

5

Maternité

supgroup

6

Depositaire

supgroup

7

Autre

Thank you!

On Monday, April 28, 2014 6:35:03 PM UTC+1, Mitch Sundt wrote:

If you have a repeat group 'rpt', with the category selection question
'q1' :

/data/rpt/q1

Then you should be able to do something like

count(/data/rpt[q1='a'])

to get the count of category a selections

etc.

Things are much more difficult if you have a multiple-choice selection.
I'll leave that to you...

The available functions are http://opendatakit.org/help/
form-design/binding/

Note that select-one and select-multiple values are always strings, so
even if the string values for the selection choices are entirely digits,
you will need to convert them to numbers should you want to do any
calculations with them.

Mitch

On Mon, Apr 28, 2014 at 4:09 AM, Bill Olander billyo...@gmail.comwrote:

Hi all,
I'm trying to ask a question within a repeat group:

What category does this person belong to?

1. a
2. b
3. c
4. d

After closing the repeat group, I'd like to create variable's counting
the number of each category on the main table:
Number of category a:
Number of category b:
and so on

I'm feeling a little dumb. Could anyway donate their thoughts on how
they would do this expression/calculation?

Thanks!
Bill

## --

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send

--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com

## --

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

\$hit, \$hit. it's not working. anything else i can try?

much respect.

Bill,

Post the XML to http://dpaste.com and send out a link.

Yaw

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

On Tue, Apr 29, 2014 at 12:47 PM, Bill Olander billyolander@gmail.comwrote:

\$hit, \$hit. it's not working. anything else i can try?

much respect.

On Tuesday, April 29, 2014 5:22:50 PM UTC+1, Ian Lawrence wrote:

Hi

You need to count the variable not the label assigned to that variable. So

count(/data/superviseesr[superviseefunctiongrp='1'])

Regards

On Tue, Apr 29, 2014 at 12:26 PM, Bill Olander billyo...@gmail.comwrote:

Thanks Mitch!

Despite the very clear answer, I can't get this to work and my
calculation always returns a zero. Could ask you or any other kind soul to
take a look at my xls and tell me what I'm being stupid about:

Type

Name

label

Repeat_count

calculation

begin repeat

superviseesr

\${supervisees_count}

calculate

position2

Line number

position(..)

begin group

supervisees

PERSONNES SUPERVISEES :

text

superviseenom

Prenoms et Nom de Supervisees #\${position2} *

text

superviseefunction

Function de Supervisee #\${position2} *

select_one supgroup

superviseefunctiongrp

Catégorie de Supervisee #\${position2} *

end group

end repeat

calculate

superviseecnt1

Count of Consultation Externe

count(/data/superviseesr[superviseefunctiongrp='Consultation Externe'])

note

superviseecnt1note

Count of Consultation Externe: \${superviseecnt1}

where my choices look like this:

supgroup

1

Consultation Externe

supgroup

2

Médecine

supgroup

3

supgroup

4

Hospitalisation Pédiatrie

supgroup

5

Maternité

supgroup

6

Depositaire

supgroup

7

Autre

Thank you!

On Monday, April 28, 2014 6:35:03 PM UTC+1, Mitch Sundt wrote:

If you have a repeat group 'rpt', with the category selection question
'q1' :

/data/rpt/q1

Then you should be able to do something like

count(/data/rpt[q1='a'])

to get the count of category a selections

etc.

Things are much more difficult if you have a multiple-choice selection.
I'll leave that to you...

The available functions are http://opendatakit.org/help/fo
rm-design/binding/

Note that select-one and select-multiple values are always strings, so
even if the string values for the selection choices are entirely digits,
you will need to convert them to numbers should you want to do any
calculations with them.

Mitch

On Mon, Apr 28, 2014 at 4:09 AM, Bill Olander billyo...@gmail.comwrote:

Hi all,
I'm trying to ask a question within a repeat group:

What category does this person belong to?

1. a
2. b
3. c
4. d

After closing the repeat group, I'd like to create variable's counting
the number of each category on the main table:
Number of category a:
Number of category b:
and so on

I'm feeling a little dumb. Could anyway donate their thoughts on
how they would do this expression/calculation?

Thanks!
Bill

## --

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send

--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com

## --

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send

--
--

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

yaw, thanks.

the first part of the questionnaire (which has the
problem): http://dpaste.com/3VHV97X/

the next half, just in case: http://dpaste.com/0F0W5RB/

As I suspected...

/GrilledeSupervisionFINAL12/superviseesr/supervisees/superviseefunctiongrp
is the path to the variable in question.

count(/GrilledeSupervisionFINAL12/superviseesr/supervisees[superviseefunctiongrp='1'])
is probably what you want.

Yaw

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

On Tue, Apr 29, 2014 at 2:17 PM, Bill Olander billyolander@gmail.comwrote:

yaw, thanks.

the first part of the questionnaire (which has the problem):
http://dpaste.com/3VHV97X/

the next half, just in case: http://dpaste.com/0F0W5RB/

On Tuesday, April 29, 2014 9:43:08 PM UTC+1, Yaw Anokwa wrote:

Bill,

Post the XML to http://dpaste.com and send out a link.

## Yaw

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

On Tue, Apr 29, 2014 at 12:47 PM, Bill Olander billyo...@gmail.comwrote:

\$hit, \$hit. it's not working. anything else i can try?

much respect.

On Tuesday, April 29, 2014 5:22:50 PM UTC+1, Ian Lawrence wrote:

Hi

You need to count the variable not the label assigned to that variable.
So

count(/data/superviseesr[superviseefunctiongrp='1'])

Regards

On Tue, Apr 29, 2014 at 12:26 PM, Bill Olander billyo...@gmail.comwrote:

Thanks Mitch!

Despite the very clear answer, I can't get this to work and my
calculation always returns a zero. Could ask you or any other kind soul to
take a look at my xls and tell me what I'm being stupid about:

Type

Name

label

Repeat_count

calculation

begin repeat

superviseesr

\${supervisees_count}

calculate

position2

Line number

position(..)

begin group

supervisees

PERSONNES SUPERVISEES :

text

superviseenom

Prenoms et Nom de Supervisees #\${position2} *

text

superviseefunction

Function de Supervisee #\${position2} *

select_one supgroup

superviseefunctiongrp

Catégorie de Supervisee #\${position2} *

end group

end repeat

calculate

superviseecnt1

Count of Consultation Externe

count(/data/superviseesr[superviseefunctiongrp='Consultation
Externe'])

note

superviseecnt1note

Count of Consultation Externe: \${superviseecnt1}

where my choices look like this:

supgroup

1

Consultation Externe

supgroup

2

Médecine

supgroup

3

supgroup

4

Hospitalisation Pédiatrie

supgroup

5

Maternité

supgroup

6

Depositaire

supgroup

7

Autre

Thank you!

On Monday, April 28, 2014 6:35:03 PM UTC+1, Mitch Sundt wrote:

If you have a repeat group 'rpt', with the category selection
question 'q1' :

/data/rpt/q1

Then you should be able to do something like

count(/data/rpt[q1='a'])

to get the count of category a selections

etc.

Things are much more difficult if you have a multiple-choice
selection. I'll leave that to you...

The available functions are http://opendatakit.org/help/fo
rm-design/binding/

Note that select-one and select-multiple values are always strings,
so even if the string values for the selection choices are entirely digits,
you will need to convert them to numbers should you want to do any
calculations with them.

Mitch

On Mon, Apr 28, 2014 at 4:09 AM, Bill Olander billyo...@gmail.comwrote:

Hi all,
I'm trying to ask a question within a repeat group:

What category does this person belong to?

1. a
2. b
3. c
4. d

After closing the repeat group, I'd like to create variable's
counting the number of each category on the main table:
Number of category a:
Number of category b:
and so on

I'm feeling a little dumb. Could anyway donate their thoughts on
how they would do this expression/calculation?

Thanks!
Bill

## --

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it,

--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com

## --

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send

--
--

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send

--
--