# Computing complex background computations

**URL:** <https://forum.getodk.org/t/computing-complex-background-computations/202>\
**Category:** Support\
**Created:** [November 23, 2010, 4:44pm UTC](https://forum.getodk.org/t/computing-complex-background-computations/202 "2010-11-23T16:44:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ulli](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/u/f04885/32.png) [@Ulli](https://forum.getodk.org/u/Ulli)\
**Post date:** [November 23, 2010, 4:44pm UTC](https://forum.getodk.org/t/computing-complex-background-computations/202/1 "2010-11-23T16:44:47Z")

</div>

Is it possible to compute values in the background in order to test  
the consistency of the answers provided?  
For example:  
-Computing per capita caloric consumption over recall period, to  
compare against maximum threshold (e.g., two people cannot physically  
eat 50kg of rice in two days)  
-Compute unit value of purchased food items, or unit value of sold  
crops

My guess is that it might be possible but the functionality would be  
limited by the fact that you are only able to include one constraint  
per question.

Has anyone done this? Have an idea how to do this?

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [November 26, 2010, 3:55am UTC](https://forum.getodk.org/t/computing-complex-background-computations/202/2 "2010-11-26T03:55:58Z")

</div>

yes. you should be able to use a combination of calculate and  
constraints to check consistency of answers.

> **···**
>
> On Tue, Nov 23, 2010 at 08:44, Ulli wrote: \> Is it possible to compute values in the background in order to test \> the consistency of the answers provided? \> For example: \> -Computing per capita caloric consumption over recall period, to \> compare against maximum threshold (e.g., two people cannot physically \> eat 50kg of rice in two days) \> -Compute unit value of purchased food items, or unit value of sold \> crops \> \> My guess is that it might be possible but the functionality would be \> limited by the fact that you are only able to include one constraint \> per question. \> \> Has anyone done this? Have an idea how to do this? \> \> -- \> Post: opendatakit@googlegroups.com \> Unsubscribe: opendatakit+unsubscribe@googlegroups.com \> Options: http://groups.google.com/group/opendatakit?hl=en \>

---

<div class="post-metadata">

**Author:** ![Ulli](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/u/f04885/32.png) [@Ulli](https://forum.getodk.org/u/Ulli)\
**Post date:** [November 29, 2010, 3:28pm UTC](https://forum.getodk.org/t/computing-complex-background-computations/202/3 "2010-11-29T15:28:23Z")

</div>

But you are limited to one constraint per questions, so there is a  
limit to the complexity for now. Right?

> **···**
>
> On Nov 25, 10:55 pm, Yaw Anokwa wrote: \> yes. you should be able to use a combination of calculate and \> constraints to check consistency of answers. \> \> \> \> \> \> \> \> On Tue, Nov 23, 2010 at 08:44, Ulli wrote: \> \> Is it possible to compute values in the background in order to test \> \> the consistency of the answers provided? \> \> For example: \> \> -Computing per capita caloric consumption over recall period, to \> \> compare against maximum threshold (e.g., two people cannot physically \> \> eat 50kg of rice in two days) \> \> -Compute unit value of purchased food items, or unit value of sold \> \> crops \> \> \> My guess is that it might be possible but the functionality would be \> \> limited by the fact that you are only able to include one constraint \> \> per question. \> \> \> Has anyone done this? Have an idea how to do this? \> \> \> -- \> \> Post: opendatakit@googlegroups.com \> \> Unsubscribe: opendatakit+unsubscribe@googlegroups.com \> \> Options:http://groups.google.com/group/opendatakit?hl=en

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [November 29, 2010, 3:36pm UTC](https://forum.getodk.org/t/computing-complex-background-computations/202/4 "2010-11-29T15:36:03Z")

</div>

you can have one constraint per question, but that constraint can  
evaluate any number of xpath expressions.

> **···**
>
> On Mon, Nov 29, 2010 at 07:28, Ulli wrote: \> But you are limited to one constraint per questions, so there is a \> limit to the complexity for now. Right? \> \> \> On Nov 25, 10:55 pm, Yaw Anokwa wrote: \>\> yes. you should be able to use a combination of calculate and \>\> constraints to check consistency of answers. \>\> \>\> \>\> \>\> \>\> \>\> \>\> \>\> On Tue, Nov 23, 2010 at 08:44, Ulli wrote: \>\> \> Is it possible to compute values in the background in order to test \>\> \> the consistency of the answers provided? \>\> \> For example: \>\> \> -Computing per capita caloric consumption over recall period, to \>\> \> compare against maximum threshold (e.g., two people cannot physically \>\> \> eat 50kg of rice in two days) \>\> \> -Compute unit value of purchased food items, or unit value of sold \>\> \> crops \>\> \>\> \> My guess is that it might be possible but the functionality would be \>\> \> limited by the fact that you are only able to include one constraint \>\> \> per question. \>\> \>\> \> Has anyone done this? Have an idea how to do this? \>\> \>\> \> -- \>\> \> Post: opendatakit@googlegroups.com \>\> \> Unsubscribe: opendatakit+unsubscribe@googlegroups.com \>\> \> Options:http://groups.google.com/group/opendatakit?hl=en \> \> -- \> Post: opendatakit@googlegroups.com \> Unsubscribe: opendatakit+unsubscribe@googlegroups.com \> Options: http://groups.google.com/group/opendatakit?hl=en \>
