Total of fields should be 100

I have three fields that accept integer values. I need to make sure that
the sum of the values should not exceed 100. How do I do this? This is for
percentage.

See: http://opendatakit.org/help/form-design/binding/

If using XLSForm, you can set up a constraint column with a formula like:

${field1} + ${field2} + ${field3} = 100

See http://opendatakit.org/help/form-design/xlsform/ for more info.

Note that if you are working with decimal values, and not integer values,
you will probably need to allow for some rounding error (e.g., 99.9 - 100.1
% or something like that).

ยทยทยท On Tue, Oct 15, 2013 at 10:00 PM, Jack Elendil Lagare < jackeblagare@gmail.com> wrote:

I have three fields that accept integer values. I need to make sure that
the sum of the values should not exceed 100. How do I do this? This is for
percentage.

--

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

Where do I put this? My initial thought is to have a trigger screen that
will only display if values are greater than 100. Is there another way?

ยทยทยท On Friday, October 18, 2013 1:44:02 AM UTC+8, Mitch Sundt wrote: > > See: http://opendatakit.org/help/form-design/binding/ > > If using XLSForm, you can set up a constraint column with a formula like: > > ${field1} + ${field2} + ${field3} = 100 > > See http://opendatakit.org/help/form-design/xlsform/ for more info. > > Note that if you are working with decimal values, and not integer values, > you will probably need to allow for some rounding error (e.g., 99.9 - 100.1 > % or something like that). > > > > On Tue, Oct 15, 2013 at 10:00 PM, Jack Elendil Lagare <jackeb...@gmail.com wrote: > >> I have three fields that accept integer values. I need to make sure that >> the sum of the values should not exceed 100. How do I do this? This is for >> percentage. >> >> -- >> -- >> 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. >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

Hi Jack,
Are you working with XLS forms or programming this by hand? I think the
best way to do this is to set a constraint on the 3rd field that will add
all fields together and set off a constraint message if your fields do not
add up to 100.

In the bindings, you want to write:
constraint="(. + field2 + field1) = 100" jr:constraintMsg="The values in
the last three fields have to add up to 100%."

That should give you a warning when that constraint is not true.

j

ยทยทยท On Mon, Oct 21, 2013 at 8:53 PM, Jack Elendil Lagare <jackeblagare@gmail.com wrote:

Where do I put this? My initial thought is to have a trigger screen that
will only display if values are greater than 100. Is there another way?

On Friday, October 18, 2013 1:44:02 AM UTC+8, Mitch Sundt wrote:

See: http://opendatakit.org/help/**form-design/binding/http://opendatakit.org/help/form-design/binding/

If using XLSForm, you can set up a constraint column with a formula like:

${field1} + ${field2} + ${field3} = 100

See http://opendatakit.org/help/**form-design/xlsform/http://opendatakit.org/help/form-design/xlsform/for more info.

Note that if you are working with decimal values, and not integer values,
you will probably need to allow for some rounding error (e.g., 99.9 - 100.1
% or something like that).

On Tue, Oct 15, 2013 at 10:00 PM, Jack Elendil Lagare < jackeb...@gmail.com> wrote:

I have three fields that accept integer values. I need to make sure that
the sum of the values should not exceed 100. How do I do this? This is for
percentage.

--

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 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_outhttps://groups.google.com/groups/opt_out
.

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

--

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'm programming by hand. Ok, I will try this one out. Thanks Jitka.

ยทยทยท On Oct 22, 2013, at 10:04 AM, Jitka Hiscox wrote:

Hi Jack,
Are you working with XLS forms or programming this by hand? I think the best way to do this is to set a constraint on the 3rd field that will add all fields together and set off a constraint message if your fields do not add up to 100.

In the bindings, you want to write:
constraint="(. + field2 + field1) = 100" jr:constraintMsg="The values in the last three fields have to add up to 100%."

That should give you a warning when that constraint is not true.

j

On Mon, Oct 21, 2013 at 8:53 PM, Jack Elendil Lagare jackeblagare@gmail.com wrote:
Where do I put this? My initial thought is to have a trigger screen that will only display if values are greater than 100. Is there another way?

On Friday, October 18, 2013 1:44:02 AM UTC+8, Mitch Sundt wrote:
See: http://opendatakit.org/help/form-design/binding/

If using XLSForm, you can set up a constraint column with a formula like:

${field1} + ${field2} + ${field3} = 100

See http://opendatakit.org/help/form-design/xlsform/ for more info.

Note that if you are working with decimal values, and not integer values, you will probably need to allow for some rounding error (e.g., 99.9 - 100.1 % or something like that).

On Tue, Oct 15, 2013 at 10:00 PM, Jack Elendil Lagare jackeb...@gmail.com wrote:
I have three fields that accept integer values. I need to make sure that the sum of the values should not exceed 100. How do I do this? This is for percentage.

--

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.

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

--

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 a topic in the Google Groups "ODK Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/opendatakit/6xvJHi234i8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi guys,

I'm doing exactly the same thing (${canopy2} + ${canopy3} + ${canopy4} + ${canopy5} + ${canopy6}) = 100 and doesn't seem to be working for me.

All the variables are collected from prior page as integers and i'm using a note (type) XLSForm to emphasize with the above formula added to bind:constraint.

I'm using ODK collect 1.4.3(1040)

Richard

Hi Richard,

The community can't help unless we can see a test case with the
precise problem. I've attached a sample form that shows a totaling.

I add up everything in a calculate. Then use a note after the
calculate to show an error and require the user to go back and change
the numbers to validate. I then make the note required and relevant
when ${total} > 100.

Hope that helps,

Yaw

total_warning.xlsx (9.79 KB)

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

On Fri, May 16, 2014 at 1:04 PM, ngamita@gmail.com wrote:

Hi guys,

I'm doing exactly the same thing (${canopy2} + ${canopy3} + ${canopy4} + ${canopy5} + ${canopy6}) = 100 and doesn't seem to be working for me.

All the variables are collected from prior page as integers and i'm using a note (type) XLSForm to emphasize with the above formula added to bind:constraint.

I'm using ODK collect 1.4.3(1040)

Richard

--

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.

Thanks Yaw, this is exactly what i wanted and didn't know i could use
required in this way. I've noted the test case requirement :).

ยทยทยท On Sat, May 17, 2014 at 11:04 PM, Yaw Anokwa wrote:

Hi Richard,

The community can't help unless we can see a test case with the
precise problem. I've attached a sample form that shows a totaling.

I add up everything in a calculate. Then use a note after the
calculate to show an error and require the user to go back and change
the numbers to validate. I then make the note required and relevant
when ${total} > 100.

Hope that helps,

Yaw

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

On Fri, May 16, 2014 at 1:04 PM, ngamita@gmail.com wrote:

Hi guys,

I'm doing exactly the same thing (${canopy2} + ${canopy3} + ${canopy4} +
${canopy5} + ${canopy6}) = 100 and doesn't seem to be working for me.

All the variables are collected from prior page as integers and i'm
using a note (type) XLSForm to emphasize with the above formula added to
bind:constraint.

I'm using ODK collect 1.4.3(1040)

Richard

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/6xvJHi234i8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cool, and if you want EXACTLY 100 only. You'll have to go with ${total} >
100 or ${total} < 100. Hope it helps someone else some day :).

ยทยทยท On Mon, May 19, 2014 at 4:26 PM, Ngamita Richard wrote:

Thanks Yaw, this is exactly what i wanted and didn't know i could use
required in this way. I've noted the test case requirement :).

On Sat, May 17, 2014 at 11:04 PM, Yaw Anokwa yanokwa@nafundi.com wrote:

Hi Richard,

The community can't help unless we can see a test case with the
precise problem. I've attached a sample form that shows a totaling.

I add up everything in a calculate. Then use a note after the
calculate to show an error and require the user to go back and change
the numbers to validate. I then make the note required and relevant
when ${total} > 100.

Hope that helps,

Yaw

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

On Fri, May 16, 2014 at 1:04 PM, ngamita@gmail.com wrote:

Hi guys,

I'm doing exactly the same thing (${canopy2} + ${canopy3} + ${canopy4}

  • ${canopy5} + ${canopy6}) = 100 and doesn't seem to be working for me.

All the variables are collected from prior page as integers and i'm
using a note (type) XLSForm to emphasize with the above formula added to
bind:constraint.

I'm using ODK collect 1.4.3(1040)

Richard

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/6xvJHi234i8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

1 Like