Error: There has been a problem trying to replace ${yn} with the XPath to the survey element named 'yn'. There is no survey element with this name

1. What is the issue? Please be detailed.

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?

Hello ODK Community,

I am making my first ever survey on ODK. I keep getting the message below but can not see the error. I have seen a few posts with similar themes but can't see what is wrong with mine as it is a simple yn. I think I am missing the obvious. My eyes will get better at spotting the errors with time!

Thanks for your help,
Lena
ZGSY LG Bike Phone Survey.xlsx (59.0 KB)

4. Upload any test forms, screenshots, or logs below.

[Error: There has been a problem trying to replace ${yn} with the XPath to the survey element named 'yn'. There is no survey element with this name.](https://Error: There has been a problem trying to replace ${yn} with the XPath to the survey element named 'yn'. There is no survey element with this name.)

1 Like

In your form 'yn' refers to a choice list (for 'yes' vs 'no')

Screen Shot 2022-04-30 at 4.38.07 PM

But you appear to be referencing the choice list in your relevant (XPath) expressions, whereas the things you reference in relevant/constraint/calculations need to refer to the actual form's select question, not the choice list that the select question happens to use... To be precise, this is probably the culprit:

Instead of relevant: selected(${yn},'2') I think you probably want to check whether the question ${MBW_school_timetable} includes 'n' as the response; ie

relevant = selected(${MBW_school_timetable},'2')

Aside: since MBW_school_timetable is a select_one - as opposed to a select_multiple - using a selected(...) check is kinda overkill, since it'll only ever have a single response. That is, you can probably get away with a simpler:

relevant: ${MBW_school_timetable} = '2'

[BTW, you are doing the above in a bunch of places in your form - not just with MBW_school_timetable - so I'd probably suggest going thru the entire form and making the correction.]

2 Likes