Select to view content in your preferred language

Repeat error: Failed to execute 'evaluate' on 'XPathEvaluator'

06-06-2022 10:57 AM
New Contributor

Hello. I am developing a survey with several nested repeats, which have worked in the past. But since June 1, I repeatedly get the following error message whenever I try to access the survey through Survey123 (developed using Survey123 Connect XLS form):

Error: Initializing form...
  • FormLogicError: Could not evaluate: selected( /model/instance[1]/Test_CO2_Matchmaker/activity_specific_questions/co2_activity_type ,'Other'), message: Failed to execute 'evaluate' on 'XPathEvaluator': parameter 2 is not of type 'Node'.

I receive no error messages on Survey123 Connect when update the survey or publish. I have had temporary luck creating an exact copy of the survey in Survey123 Connect, publishing the copy, and having it work on Survey123 (at least, until I try to make any changes, then the error reappears); but as of today, this work around no longer works. I attached the XLSForm for assistance. 

0 Kudos
5 Replies
MVP Esteemed Contributor

My guess is your field names are too long or the name of that list names are really long.

Field names are limited to 31 chars and this one for example is 33 generated_group_surveydescription  It even yelled at me about it.

Your list names are crazy long and probably hitting a limit  list_activity_specific_questions_co2_producer_activity_status

I would make the fields and csv shorter and start there.  Hope that helps.

I am also not sure you can put this kind of html in there now <p><span style="font-size: 16px;"> but really not sure on that one.

MVP Esteemed Contributor

Oh also a good chance it does not like these special chars here on the 2.  I would remove those as they will not store correctly anyway.  Good idea to never use special chars like this.  Happens a lot. The error is saying it is this question so good place to start.



New Contributor

Thanks @DougBrowning for the tips. I performed all those actions, but didn't have any success in resolving the error. But, it seems changing the text within the "Relevant" from selected(${FIELD NAME},'LIST NAME') to if(selected(${FIELD NAME},'LIST NAME'),1,0) seems to have gotten rid of the error. 

0 Kudos
Esri Contributor

Hi @jbauer I'm able to reproduce the issue you are experiencing with a survey I published  with your XLS form. It seems like the error is reproduced when a repeat with relevant expression has a dynamic repeat count. For example, there is a repeat in your survey called "activity_prod". This repeat has a relevant expression "selected(${co2_activity_type},'Producer')" and the repeat count is determined by another question ("${num_prod}"). 


Removing the calculation for the repeat_count and replacing it with a number resolves the issue but it may not be a viable workaround. 

On the other hand, removing the relevant expression for the begin repeat and adding it to the questions inside the repeat which also resolves the error might be a better workaround for you. 



I recommend reaching out to Technichal Support to report this issue and log a defect against it if needed. 




New Contributor III

Hello. I have noticed that I had the same error, I detected that it was caused by the combination of relevant and repeat_count in the same repeat question.

It seems that the relevant process cannot be combined with the number of repetitions in the same field when using it at the web.