Constraint so total has to add up sum of other integer fields

Hi all,

will someone please help me. I've also googled old discussions, but can't
find it. I think this should be straight forward, but I can't figure out
how to script the following constraint. One one screen, I have three fields
-- Total, A, B.

I want to add a constraint, that says that Total has to be a sum of A & B.
Assuming the nodeset names are form/Total, form/B, etc., what is the
syntax??

constraint=("form/Total" = ....

I will be very grateful for your help.
j

Hi Jitka,

You should consider automatically calculating the total so the user
does not have to enter it.

If you want manual totaling, the below code should work in a constraint.
constraint="(/data/a + /data/b) eq /data/total"

Yaw

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

On Tue, Sep 17, 2013 at 1:32 PM, Jitka Hiscox jitka.hiscox@gmail.com wrote:

Hi all,

will someone please help me. I've also googled old discussions, but can't
find it. I think this should be straight forward, but I can't figure out
how to script the following constraint. One one screen, I have three fields
-- Total, A, B.

I want to add a constraint, that says that Total has to be a sum of A & B.
Assuming the nodeset names are form/Total, form/B, etc., what is the
syntax??

constraint=("form/Total" = ....

I will be very grateful for your help.
j

--

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.

Thanks Yaw!

··· On Thu, Sep 19, 2013 at 11:24 AM, Yaw Anokwa wrote:

Hi Jitka,

You should consider automatically calculating the total so the user
does not have to enter it.

If you want manual totaling, the below code should work in a constraint.
constraint="(/data/a + /data/b) eq /data/total"

Yaw

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

On Tue, Sep 17, 2013 at 1:32 PM, Jitka Hiscox jitka.hiscox@gmail.com wrote:

Hi all,

will someone please help me. I've also googled old discussions, but can't
find it. I think this should be straight forward, but I can't figure out
how to script the following constraint. One one screen, I have three
fields
-- Total, A, B.

I want to add a constraint, that says that Total has to be a sum of A &
B.
Assuming the nodeset names are form/Total, form/B, etc., what is the
syntax??

constraint=("form/Total" = ....

I will be very grateful for your help.
j

--

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.

Similar question so I'm adding here instead of starting a new thread.

My form is asking for household headcounts in divided by Adult_Male,
Adult_Female, and children in 3 age groupings. (total of 5 fields)

After these 5 questions I want an acknowledgement screen for accuracy
control
In the DISPLAY of this field, I would like it to calculate and display the
total of the 5 headcount questions,

Can I have an acknowledgement button AND a displayed calculation together?
Does the calculate function belong inside the output value in the label??

··· On Thursday, September 19, 2013 1:34:55 PM UTC-4, Jitka Hiscox wrote: > > Thanks Yaw! > > > On Thu, Sep 19, 2013 at 11:24 AM, Yaw Anokwa <yan...@nafundi.com wrote: > >> Hi Jitka, >> >> You should consider automatically calculating the total so the user >> does not have to enter it. >> >> >> If you want manual totaling, the below code should work in a constraint. >> constraint="(/data/a + /data/b) eq /data/total" >> >> Yaw >> -- >> Need ODK services? http://nafundi.com provides form design, >> professional support, custom reporting, and software development for >> ODK. >> >> On Tue, Sep 17, 2013 at 1:32 PM, Jitka Hiscox <jitka....@gmail.com> wrote: >> > Hi all, >> > >> > will someone please help me. I've also googled old discussions, but >> can't >> > find it. I think this should be straight forward, but I can't figure >> out >> > how to script the following constraint. One one screen, I have three >> fields >> > -- Total, A, B. >> > >> > I want to add a constraint, that says that Total has to be a sum of A & >> B. >> > Assuming the nodeset names are form/Total, form/B, etc., what is the >> > syntax?? >> > >> > constraint=("form/Total" = .... >> > >> > I will be very grateful for your help. >> > j >> > >> > >> > -- >> > -- >> > 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. >> > >

Ok, this is weird of me, but I'm going to post the answer to my own
question here, because I kept trying different things and got it to work.

In the Total field, include an output value in the label (display)

Is there a total of people
in this household?

the calculation goes in the binding:

and lastly, you have to use "trigger ref " in the body

I build forms with the odk build tool, but anyone who uses different tools
can probably apply this info to their format.

··· On Friday, April 4, 2014 3:51:22 PM UTC-4, Ruth Little wrote: > > Similar question so I'm adding here instead of starting a new thread. > > My form is asking for household headcounts in divided by Adult_Male, > Adult_Female, and children in 3 age groupings. (total of 5 fields) > > After these 5 questions I want an acknowledgement screen for accuracy > control > In the DISPLAY of this field, I would like it to calculate and display the > total of the 5 headcount questions, > > Can I have an acknowledgement button AND a displayed calculation together? > Does the calculate function belong inside the output value in the label?? > > > > > > On Thursday, September 19, 2013 1:34:55 PM UTC-4, Jitka Hiscox wrote: >> >> Thanks Yaw! >> >> >> On Thu, Sep 19, 2013 at 11:24 AM, Yaw Anokwa wrote: >> >>> Hi Jitka, >>> >>> You should consider automatically calculating the total so the user >>> does not have to enter it. >>> >> type="decimal"/> >>> >>> If you want manual totaling, the below code should work in a constraint. >>> constraint="(/data/a + /data/b) eq /data/total" >>> >>> Yaw >>> -- >>> Need ODK services? http://nafundi.com provides form design, >>> professional support, custom reporting, and software development for >>> ODK. >>> >>> On Tue, Sep 17, 2013 at 1:32 PM, Jitka Hiscox wrote: >>> > Hi all, >>> > >>> > will someone please help me. I've also googled old discussions, but >>> can't >>> > find it. I think this should be straight forward, but I can't figure >>> out >>> > how to script the following constraint. One one screen, I have three >>> fields >>> > -- Total, A, B. >>> > >>> > I want to add a constraint, that says that Total has to be a sum of A >>> & B. >>> > Assuming the nodeset names are form/Total, form/B, etc., what is the >>> > syntax?? >>> > >>> > constraint=("form/Total" = .... >>> > >>> > I will be very grateful for your help. >>> > j >>> > >>> > >>> > -- >>> > -- >>> > 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. >>> >> >>

If an automatic calculation is used, would the syntax be calculate="(/data/a + /data/b)"? Thanks,