# Running total validation

**URL:** <https://forum.dimagi.com/t/running-total-validation/2792>\
**Category:** Users\
**Created:** [June 16, 2016, 1:46pm UTC](https://forum.dimagi.com/t/running-total-validation/2792 "2016-06-16T13:46:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Mullikin](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@Justin\_Mullikin](https://forum.dimagi.com/u/Justin_Mullikin)\
**Post date:** [June 16, 2016, 1:46pm UTC](https://forum.dimagi.com/t/running-total-validation/2792/1 "2016-06-16T13:46:30Z")

</div>

I have a section of a form which asks about plots of land and how they're  
being used. The respondent says they have x number of plots and then the  
form loops through a set of questions about each of them, including the  
size (area) of the plot in ares, what crops are grown on that plot, and the  
area of each crop. I can set a calculation for each crop to make sure it  
doesn't exceed the area of the plot and then another calculation at the end  
of the loop to make sure total crop area doesn't exceed the total plot  
area.

Ideally, I'd like the form to keep a running total of the crop area and  
notify the enumerator when the area of crops has exceeded the size of the  
plot. Any ideas how I might go about this? I'm currently building this form  
in Excel and then converting it to XML for upload into CommCare. A sample  
Excel file of the above described loop is attached.

Thanks!  
Justin

[land\_use\_loop\_example.xlsx](https://dimagi.b-cdn.net/uploads/default/original/1X/850fa0c36cbfb9904036df9570868c1b9c5a77f2.xlsx) (50.1 KB)

---

<div class="post-metadata">

**Author:** ![William\_Pride](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@William\_Pride](https://forum.dimagi.com/u/William_Pride)\
**Post date:** [June 16, 2016, 2:56pm UTC](https://forum.dimagi.com/t/running-total-validation/2792/2 "2016-06-16T14:56:18Z")

</div>

Justin,

Have you tried adding a validation condition to each individual area  
question in the repeat that checks the sum of these areas (similar to what  
you mentioned at the end of the loop)?

You could also add a label to each repeated group that only appears if the  
area sum has been exceeded (same calculation) (which could possibly block  
proceeding).

-Will

> **···**
>
> On Thu, Jun 16, 2016 at 9:46 AM, wrote:
> 
> > I have a section of a form which asks about plots of land and how they're  
> > being used. The respondent says they have x number of plots and then the  
> > form loops through a set of questions about each of them, including the  
> > size (area) of the plot in ares, what crops are grown on that plot, and the  
> > area of each crop. I can set a calculation for each crop to make sure it  
> > doesn't exceed the area of the plot and then another calculation at the end  
> > of the loop to make sure total crop area doesn't exceed the total plot  
> > area.
> > 
> > Ideally, I'd like the form to keep a running total of the crop area and  
> > notify the enumerator when the area of crops has exceeded the size of the  
> > plot. Any ideas how I might go about this? I'm currently building this form  
> > in Excel and then converting it to XML for upload into CommCare. A sample  
> > Excel file of the above described loop is attached.
> > 
> > Thanks!  
> > Justin
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "commcare-users" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Justin\_Mullikin](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@Justin\_Mullikin](https://forum.dimagi.com/u/Justin_Mullikin)\
**Post date:** [June 20, 2016, 11:38am UTC](https://forum.dimagi.com/t/running-total-validation/2792/3 "2016-06-20T11:38:30Z")

</div>

Hi Will,

Yes! That works. It’s not quite as elegant as I would like because I have a lot of crop iterations but it will do!

Justin

> **···**
>
> -- TUBURA | One Acre Fund, Rwanda +250 (0)78 433 6281 www.oneacrefund.org
> 
> > On Jun 16, 2016, at 16:56, William Pride [wpride@dimagi.com](mailto:wpride@dimagi.com) wrote:
> > 
> > Justin,
> > 
> > Have you tried adding a validation condition to each individual area question in the repeat that checks the sum of these areas (similar to what you mentioned at the end of the loop)?
> > 
> > You could also add a label to each repeated group that only appears if the area sum has been exceeded (same calculation) (which could possibly block proceeding).
> > 
> > -Will
> > 
> > On Thu, Jun 16, 2016 at 9:46 AM, \<[justin.mullikin@oneacrefund.org](mailto:justin.mullikin@oneacrefund.org) [mailto:justin.mullikin@oneacrefund.org](mailto:justin.mullikin@oneacrefund.org)\> wrote:  
> > I have a section of a form which asks about plots of land and how they're being used. The respondent says they have x number of plots and then the form loops through a set of questions about each of them, including the size (area) of the plot in ares, what crops are grown on that plot, and the area of each crop. I can set a calculation for each crop to make sure it doesn't exceed the area of the plot and then another calculation at the end of the loop to make sure total crop area doesn't exceed the total plot area.
> > 
> > Ideally, I'd like the form to keep a running total of the crop area and notify the enumerator when the area of crops has exceeded the size of the plot. Any ideas how I might go about this? I'm currently building this form in Excel and then converting it to XML for upload into CommCare. A sample Excel file of the above described loop is attached.
> > 
> > Thanks!  
> > Justin
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "commcare-users" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com) [mailto:commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the Google Groups "commcare-users" group.  
> > To unsubscribe from this topic, visit [https://groups.google.com/d/topic/commcare-users/TMkYu9\_1bmg/unsubscribe](https://groups.google.com/d/topic/commcare-users/TMkYu9_1bmg/unsubscribe) [https://groups.google.com/d/topic/commcare-users/TMkYu9\_1bmg/unsubscribe](https://groups.google.com/d/topic/commcare-users/TMkYu9_1bmg/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com) [mailto:commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
