# Calculate function

Hi there,

I am using ODKcollect and I have several questions in my form (9 in total) giving yes or no answers that are coded "1" and "0" on the choices tab. Is it possible to have a calculate function following these questions that calculates the sum of the coded values? So theoretically it would calculate a sum from 0 to 9?

Thanks very much for your help,
-Brett

1 Like

If you are using select1, note that the value is a string value ("1") and
not a number (1).

To convert to a number, you can use the int() function.

See https://opendatakit.org/help/form-design/binding/ for the various
functions that are available.

You could then write a computation like:

int(\${yn_q1}) + int(\${yn_q2}) + int(\${yn_q3})

··· On Mon, Nov 16, 2015 at 3:37 AM, wrote:

Hi there,

I am using ODKcollect and I have several questions in my form (9 in total)
giving yes or no answers that are coded "1" and "0" on the choices tab. Is
it possible to have a calculate function following these questions that
calculates the sum of the coded values? So theoretically it would calculate
a sum from 0 to 9?

Thanks very much for your help,
-Brett

## --

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

Hi Bret,

Hi there,

I am using ODKcollect and I have several questions in my form (9 in total)
giving yes or no answers that are coded "1" and "0"

​Since Y and N are coded 1 and 0 in the choices sheet, use question1 +
question 2 up to 9. See attached file.

Best and Regards
Ronald Munjoma

calculation.xlsx (15.2 KB)

calculation.xml (20.6 KB)

··· On 16 November 2015 at 13:37, wrote:

on the choices tab. Is it possible to have a calculate function following
these questions that calculates the sum of the coded values? So
theoretically it would calculate a sum from 0 to 9?

Thanks very much for your help,
-Brett

## --

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

--
Best and Regards
Ronald Munjoma
+263 775 625 283

[image: --]

Ronald Munjoma

Thanks Mitch for your help, I will try this out.

If I end up having all of the questions as integers with the constraint of
1 or 0 could I use a calculation argument like this:

if(\${vitaminrich}= '1' or \${darkgreenleaf}= '1' or \${othervegetables}= '1'
then .= '1') else .= '0'

My goal is to have it calculate as a 1 if any one of those elements are
identified as a 1 and if not it would be a 0. However I couldn't find any
documentation on IF/ELSE functions in ODK.

-Brett

··· On Monday, November 16, 2015 at 11:38:29 PM UTC+3, Mitch Sundt wrote: > > If you are using select1, note that the value is a string value ("1") and > not a number (1). > > To convert to a number, you can use the int() function. > > See https://opendatakit.org/help/form-design/binding/ for the various > functions that are available. > > You could then write a computation like: > > int(\${yn_q1}) + int(\${yn_q2}) + int(\${yn_q3}) > > > > On Mon, Nov 16, 2015 at 3:37 AM, <brettco...@gmail.com > wrote: > >> Hi there, >> >> I am using ODKcollect and I have several questions in my form (9 in >> total) giving yes or no answers that are coded "1" and "0" on the choices >> tab. Is it possible to have a calculate function following these questions >> that calculates the sum of the coded values? So theoretically it would >> calculate a sum from 0 to 9? >> >> Thanks very much for your help, >> -Brett >> >> -- >> -- >> 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 >

If-then-else is called 'conditional' -- see the bindings link in the
previous e-mail.

··· On Tue, Nov 17, 2015 at 5:28 AM, ronald munjoma wrote:

Hi Bret,

On 16 November 2015 at 13:37, brettcollins86@gmail.com wrote:

Hi there,

I am using ODKcollect and I have several questions in my form (9 in
total) giving yes or no answers that are coded "1" and "0"

​Since Y and N are coded 1 and 0 in the choices sheet, use question1 +
question 2 up to 9. See attached file.

Best and Regards
Ronald Munjoma

on the choices tab. Is it possible to have a calculate function following
these questions that calculates the sum of the coded values? So
theoretically it would calculate a sum from 0 to 9?

Thanks very much for your help,
-Brett

## --

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

--
Best and Regards
Ronald Munjoma
+263 775 625 283

[image: --]

Ronald Munjoma

## --

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

1 Like

Hi?
Is there a 'relevant' that restricts certain choice options (being
selected) based on a previous response (ie being Male excludes an option of
getting pregnant) without skipping questions?

I hope this makes sense.

I need help on this. Thanks in advance.

Louis...

··· On Tue, Nov 17, 2015 at 9:56 PM, Mitch Sundt wrote:

If-then-else is called 'conditional' -- see the bindings link in the
previous e-mail.

On Tue, Nov 17, 2015 at 5:28 AM, ronald munjoma simbiso@gmail.com wrote:

Hi Bret,

On 16 November 2015 at 13:37, brettcollins86@gmail.com wrote:

Hi there,

I am using ODKcollect and I have several questions in my form (9 in
total) giving yes or no answers that are coded "1" and "0"

​Since Y and N are coded 1 and 0 in the choices sheet, use question1 +
question 2 up to 9. See attached file.

Best and Regards
Ronald Munjoma

on the choices tab. Is it possible to have a calculate function
following these questions that calculates the sum of the coded values? So
theoretically it would calculate a sum from 0 to 9?

Thanks very much for your help,
-Brett

## --

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

--
Best and Regards
Ronald Munjoma
+263 775 625 283

[image: --]

Ronald Munjoma

## --

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

## --

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

Thanks a lot, Ronald. Excellent and simplified example.

··· On Tuesday, November 17, 2015 at 8:29:02 AM UTC-5, Ronald Munjoma wrote: > > Hi Bret, > > > On 16 November 2015 at 13:37, <brettco...@gmail.com > wrote: > >> Hi there, >> >> I am using ODKcollect and I have several questions in my form (9 in >> total) giving yes or no answers that are coded "1" and "0" > > > ​Since Y and N are coded 1 and 0 in the choices sheet, use question1 + > question 2 up to 9. See attached file. > > Best and Regards > Ronald Munjoma > ​ > > >> on the choices tab. Is it possible to have a calculate function following >> these questions that calculates the sum of the coded values? So >> theoretically it would calculate a sum from 0 to 9? >> >> Thanks very much for your help, >> -Brett >> >> -- >> -- >> 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. >> > > > > -- > Best and Regards > Ronald Munjoma > +263 775 625 283 > > > [image: --] > > Ronald Munjoma > [image: https://]about.me/ronaldmunjoma > >

Louis,

You might be able to use a choice_filter to restrict the choices. See
example.

Yaw

··· -- Need ODK consultants? Nafundi provides form design, server setup, in-field training, and software development for ODK. Go to https://nafundi.com to get started.

On Wed, Nov 18, 2015 at 1:13 PM, Louis Omoya louisomoya@gmail.com wrote:

Hi?
Is there a 'relevant' that restricts certain choice options (being
selected) based on a previous response (ie being Male excludes an option of
getting pregnant) without skipping questions?

I hope this makes sense.

I need help on this. Thanks in advance.

Louis...

On Tue, Nov 17, 2015 at 9:56 PM, Mitch Sundt mitchellsundt@gmail.com wrote:

If-then-else is called 'conditional' -- see the bindings link in the
previous e-mail.

On Tue, Nov 17, 2015 at 5:28 AM, ronald munjoma simbiso@gmail.com wrote:

Hi Bret,

On 16 November 2015 at 13:37, brettcollins86@gmail.com wrote:

Hi there,

I am using ODKcollect and I have several questions in my form (9 in
total) giving yes or no answers that are coded "1" and "0"

​Since Y and N are coded 1 and 0 in the choices sheet, use question1 +
question 2 up to 9. See attached file.

Best and Regards
Ronald Munjoma

on the choices tab. Is it possible to have a calculate function
following these questions that calculates the sum of the coded values? So
theoretically it would calculate a sum from 0 to 9?

Thanks very much for your help,
-Brett

## --

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

--
Best and Regards
Ronald Munjoma
+263 775 625 283

[image: --]

Ronald Munjoma

## --

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

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@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

## --

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

1 Like

I need help to make filtering work. I want it to filter Auditors and
Districts by region, then Sub-county/Parish by Districts.

I am following an example, and cant figure out what I am doing wrong.

Louis...

XLSFORM_TEMPLATE.xlsx (26.5 KB)

··· On Wed, Nov 18, 2015 at 9:40 AM, Yaw Anokwa wrote:

Louis,

You might be able to use a choice_filter to restrict the choices. See
an example.

## Yaw

Need ODK consultants? Nafundi provides form design, server setup, in-field
training, and software development for ODK. Go to https://nafundi.com to
get started.

On Wed, Nov 18, 2015 at 1:13 PM, Louis Omoya louisomoya@gmail.com wrote:

Hi?
Is there a 'relevant' that restricts certain choice options (being
selected) based on a previous response (ie being Male excludes an option of
getting pregnant) without skipping questions?

I hope this makes sense.

I need help on this. Thanks in advance.

Louis...

On Tue, Nov 17, 2015 at 9:56 PM, Mitch Sundt mitchellsundt@gmail.com wrote:

If-then-else is called 'conditional' -- see the bindings link in the
previous e-mail.

On Tue, Nov 17, 2015 at 5:28 AM, ronald munjoma simbiso@gmail.com wrote:

Hi Bret,

On 16 November 2015 at 13:37, brettcollins86@gmail.com wrote:

Hi there,

I am using ODKcollect and I have several questions in my form (9 in
total) giving yes or no answers that are coded "1" and "0"

​Since Y and N are coded 1 and 0 in the choices sheet, use question1 +
question 2 up to 9. See attached file.

Best and Regards
Ronald Munjoma

on the choices tab. Is it possible to have a calculate function
following these questions that calculates the sum of the coded values? So
theoretically it would calculate a sum from 0 to 9?

Thanks very much for your help,
-Brett

## --

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

--
Best and Regards
Ronald Munjoma
+263 775 625 283

[image: --]

Ronald Munjoma

## --

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

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@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

## --

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

Hi Louis,

See attached for correction, its best to not have the filter choice column
name on choices name as the same name as the 'name' on the survey tab. I
renamed filter_choice headings in choices tab to make it a bit more clear.

~Lloyd

XLSFORM_TEMPLATE_Updated.xlsx (25.6 KB)

Thanks alot. I will try this ASAP. Thank you for the relief.

Louis...

··· On Wed, Nov 18, 2015 at 5:39 PM, Lloyd Owen Banwart <lloyd.banwart@gmail.com wrote:

Hi Louis,

See attached for correction, its best to not have the filter choice column
name on choices name as the same name as the 'name' on the survey tab. I
renamed filter_choice headings in choices tab to make it a bit more clear.

~Lloyd

On Wednesday, November 18, 2015 at 5:53:45 AM UTC-5, Louis Omoya wrote:

I need help to make filtering work. I want it to filter Auditors and
Districts by region, then Sub-county/Parish by Districts.

I am following an example, and cant figure out what I am doing wrong.

Louis...

On Wed, Nov 18, 2015 at 9:40 AM, Yaw Anokwa yan...@nafundi.com wrote:

Louis,

You might be able to use a choice_filter to restrict the choices. See
for an example.

## Yaw

Need ODK consultants? Nafundi provides form design, server setup,
in-field training, and software development for ODK. Go to
https://nafundi.com to get started.

On Wed, Nov 18, 2015 at 1:13 PM, Louis Omoya louis...@gmail.com wrote:

Hi?
Is there a 'relevant' that restricts certain choice options (being
selected) based on a previous response (ie being Male excludes an option of
getting pregnant) without skipping questions?

I hope this makes sense.

I need help on this. Thanks in advance.

Louis...

On Tue, Nov 17, 2015 at 9:56 PM, Mitch Sundt mitche...@gmail.com wrote:

If-then-else is called 'conditional' -- see the bindings link in the
previous e-mail.

On Tue, Nov 17, 2015 at 5:28 AM, ronald munjoma sim...@gmail.com wrote:

Hi Bret,

On 16 November 2015 at 13:37, brettco...@gmail.com wrote:

Hi there,

I am using ODKcollect and I have several questions in my form (9 in
total) giving yes or no answers that are coded "1" and "0"

​Since Y and N are coded 1 and 0 in the choices sheet, use question1

• question 2 up to 9. See attached file.

Best and Regards
Ronald Munjoma

on the choices tab. Is it possible to have a calculate function
following these questions that calculates the sum of the coded values? So
theoretically it would calculate a sum from 0 to 9?

Thanks very much for your help,
-Brett

## --

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

--
Best and Regards
Ronald Munjoma
+263 775 625 283

[image: --]

Ronald Munjoma

## --

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

## --

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