# Validate errors: dependency cycles amongst the xpath expressions

**URL:** <https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404>\
**Category:** Support\
**Tags:** form-design, odk-xlsform\
**Created:** [August 5, 2018, 7:18am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404 "2018-08-05T07:18:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheuriKingori](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/theurikingori/32/4539_2.png) [@TheuriKingori](https://forum.getodk.org/u/TheuriKingori)\
**Post date:** [August 5, 2018, 7:18am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/1 "2018-08-05T07:18:09Z")

</div>

Hi,  
I have created an xls form that I want to convert for testing. However, I keep getting this error Error: b'ODK Validate Errors:\n\>\> Something broke the parser. See above for a hint.\nDependency cycles amongst the xpath expressions in relevant/calculate\n\nResult: Invalid'  
I am using version 1.2.0.  
Anyone who might know how I can resolve this problem kindly help. It is driving me crazy.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [August 5, 2018, 9:05pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/2 "2018-08-05T21:05:28Z")

</div>

Can you please post your form definition. It sounds like you may have a mutually incompatible/logically invalid pair of XPath calculations.

---

<div class="post-metadata">

**Author:** ![TheuriKingori](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/theurikingori/32/4539_2.png) [@TheuriKingori](https://forum.getodk.org/u/TheuriKingori)\
**Post date:** [August 6, 2018, 5:56am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/3 "2018-08-06T05:56:23Z")

</div>

Hi Dr. Gareth.  
Thank you for getting back to me.  
I have managed to identify where the above mentioned problem. However, another problem cropped up.  
When adding up the totals for hh incomes, hh expenditures and total incomes from other sources.

I will post the form definition so that you can have a look at it.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![TheuriKingori](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/theurikingori/32/4539_2.png) [@TheuriKingori](https://forum.getodk.org/u/TheuriKingori)\
**Post date:** [August 6, 2018, 6:02am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/4 "2018-08-06T06:02:04Z")

</div>

Please see the form definition with the raws in question highlighted in red.  
Kind regards.[Mothers\_questionnaire.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/2/2e714252bee4b32ce7fd99dd219e31d93e43bfa9.xlsx) (49.0 KB)

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [August 6, 2018, 7:50am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/5 "2018-08-06T07:50:16Z")

</div>

> [@TheuriKingori](#):
>
> I have managed to identify where the above mentioned problem

Please share what you identified the problem to be, and how you fixed it, so that perhaps others landing here in the future can determine if they hit the same problem.

If there is now something else wrong in your form, please start a new thread. BTW, a common mistake when making summation calculations - eg your "adding up the totals" - is not handling potentially null/empty operands; see [here](https://forum.getodk.org/t/calculation-questions/13294/3)

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [August 6, 2018, 7:56am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/6 "2018-08-06T07:56:08Z")

</div>

Your ${totalhhpurchaseann} is a long summation of many other values. If _any single one of these_ is not answered (ie null), then the entire sum will become invalid (NaN)! Unless every operand in your sum is mandatory, you have to explicitly add logic to your calculations to treat empty/null values as 0. Again, please refer to my previous link for details.

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [August 8, 2018, 2:54pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/7 "2018-08-08T14:54:26Z")

</div>

5 posts were split to a new topic: [Dependency cycles amongst the xpath expressions](https://forum.getodk.org/t/dependency-cycles-amongst-the-xpath-expressions/14466)

---

<div class="post-metadata">

**Author:** ![TheuriKingori](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/theurikingori/32/4539_2.png) [@TheuriKingori](https://forum.getodk.org/u/TheuriKingori)\
**Post date:** [August 7, 2018, 2:36pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/9 "2018-08-07T14:36:32Z")

</div>

Hi, Xiphware,  
The problem I found was I was adding a "relevant" function in the single select question select\_one yn. That was what was breaking the logic path in the form.

---

<div class="post-metadata">

**Author:** ![TheuriKingori](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/theurikingori/32/4539_2.png) [@TheuriKingori](https://forum.getodk.org/u/TheuriKingori)\
**Post date:** [August 7, 2018, 2:40pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/10 "2018-08-07T14:40:57Z")

</div>

I am working on amending the sum function as you have advised in your [previous forum](https://forum.getodk.org/t/calculation-questions/13294/4) post. I will post here how it goes. Thank you for your help. Much appreciated.

---

<div class="post-metadata">

**Author:** ![Riddhi\_Banerjee](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/riddhi_banerjee/32/5397_2.png) [@Riddhi\_Banerjee](https://forum.getodk.org/u/Riddhi_Banerjee)\
**Post date:** [December 5, 2018, 7:43am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/11 "2018-12-05T07:43:12Z")

</div>

Hi! I keep getting this msg:

Error: b'ODK Validate Errors:\n\>\> Something broke the parser. See above for a hint.\nDependency cycles amongst the xpath expressions in relevant/calculate\n\nResult: Invalid'

Can someone explain why I am getting this result?[Baseline\_survey\_Udaan.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/8/82e5a00c8709fb042262c92e872979174ec85f1d.xlsx) (51.8 KB)

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [December 5, 2018, 9:21pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/12 "2018-12-05T21:21:27Z")

</div>

First off, you have typos in a lot of your relevant expressions. eg

> selected(${children\_anganwadi},'yes') or **slected** (${children\_Udaan\_centre},'yes')

Start by fixing all them, and have another go.

---

<div class="post-metadata">

**Author:** ![Riddhi\_Banerjee](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/riddhi_banerjee/32/5397_2.png) [@Riddhi\_Banerjee](https://forum.getodk.org/u/Riddhi_Banerjee)\
**Post date:** [December 10, 2018, 7:09am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/13 "2018-12-10T07:09:24Z")

</div>

Thanks. I realized where i was making the mistake

---

<div class="post-metadata">

**Author:** ![ccamilocr](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@ccamilocr](https://forum.getodk.org/u/ccamilocr)\
**Post date:** [December 20, 2018, 9:24am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/14 "2018-12-20T09:24:21Z")

</div>

I need your help

ODK Validate Errors:  
Dependency cycles amongst the xpath expressions in relevant/calculate

use ODK XLSForm Offline1.8.exe  
Thank you in advance

[Household\_questionnaire.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/f/f111125a8171d815260ae7f03ea630ca6d0b7f20.xlsx) (67.8 KB)

---

<div class="post-metadata">

**Author:** ![ARIF\_AZAD\_KHAN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/arif_azad_khan/32/2921_2.png) [@ARIF\_AZAD\_KHAN](https://forum.getodk.org/u/ARIF_AZAD_KHAN)\
**Post date:** [December 20, 2018, 10:34am UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/15 "2018-12-20T10:34:11Z")

</div>

I do not get any error. Probably you attached wrong file.

---

<div class="post-metadata">

**Author:** ![ocristo](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/o/ebca7d/32.png) [@ocristo](https://forum.getodk.org/u/ocristo)\
**Post date:** [July 1, 2019, 12:55pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/17 "2019-07-01T12:55:11Z")

</div>

Oi,  
eu criei um formulário xls que eu quero converter para teste. No entanto, eu continuo recebendo este

---

<div class="post-metadata">

**Author:** ![ocristo](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/o/ebca7d/32.png) [@ocristo](https://forum.getodk.org/u/ocristo)\
**Post date:** [July 1, 2019, 12:55pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/18 "2019-07-01T12:55:46Z")

</div>

Error: b'ODK Validate Errors:\n\>\> Something broke the parser. See above for a hint.\nDependency cycles amongst the xpath expressions in relevant/calculate\n\nThe following files failed validation:\n${smart\_gb4}.xml\n\nResult: Invalid'

---

<div class="post-metadata">

**Author:** ![ocristo](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/o/ebca7d/32.png) [@ocristo](https://forum.getodk.org/u/ocristo)\
**Post date:** [July 1, 2019, 12:56pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/19 "2019-07-01T12:56:28Z")

</div>

Vou postar a definição do formulário para que você possa dar uma olhada nele.

Agradeço antecipadamente.[smart\_gb4.xlsx](https://forum.getodk.org/uploads/short-url/oVKFkr099nOmBksTzgoHaCmi42Z.xlsx) (70.9 KB)

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [July 1, 2019, 1:10pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/20 "2019-07-01T13:10:54Z")

</div>

Hi @ocristo  
the problem is in `relevant` column in lines 81 and 83  
you can't use an answer from the current question in relevant `${anje05amamnome} = 2` because it doesn't exist yet.  
What do you try to achieve? It's in repeat group so probably you want an answer from a previous repat group?

---

<div class="post-metadata">

**Author:** ![ocristo](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/o/ebca7d/32.png) [@ocristo](https://forum.getodk.org/u/ocristo)\
**Post date:** [July 1, 2019, 1:16pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/21 "2019-07-01T13:16:12Z")

</div>

O problema que põe é que queria que quando respondesse essa questão Não=2 que saltasse as questões seguintes até anje09

---

<div class="post-metadata">

**Author:** ![ocristo](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/o/ebca7d/32.png) [@ocristo](https://forum.getodk.org/u/ocristo)\
**Post date:** [July 1, 2019, 1:17pm UTC](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404/22 "2019-07-01T13:17:56Z")

</div>

[quote="ocristo, post:21, topic:14404"]  
problema que se põe é que quando respondem nessa questão Não = 2 que saltasse as para anje09

[Next page](https://forum.getodk.org/t/validate-errors-dependency-cycles-amongst-the-xpath-expressions/14404.md?page=2)
