Hi we are using custom Enketo library to load forms and save drafts in a cloud plugin and everything is working fine we are able to load forms save drafts for offline capabilities and make submissions as well.
But for forms in a specific category, we are able to open the form then save the draft but when try to re-access that draft for that form we are getting below error
loadError: FormLogicError : Could not evaluate : /data/walk_Pdselected_count, message: Failed to execute 'evaluate' on 'XPathEvaluator': parameter 2 is not of type 'Node'.
this error is only coming for this specific category of form and rest all are working fine. Does anyone has faced any similar issue before?
I have just hit the same error also with could not evaluate /model/.../count_field>0 ... Failed to execute 'evaluate' on 'XPathEvaluator': parameter 2 is not of type 'Node'. when editing in Enketo (stock ODK version) from a Collect submission. (the field is in a group, not in a repeat @MinimalPotato, the form has repeats elsewhere.)
More info -
the submission can be edited in Collect (with client_editable)
the error could be on a few different fields as it sets relevance on all of them (as >0), but it's either;
a select in the same group as the count expression
a select in a group in repeat A
repeat B inside repeat A
I expect it's # 2 or 3 as it's related to the # of elements in repeat A that's causing the error.
Strangely, the submission can be edited in Enketo with some number of repeats. Had a 4x element repeat that errored on load, but also had a 3x element repeat that I could edit repeatedly to 9x (didn't keep going) with no issues. Also have a 10x+ one that took forever on loading with a few 'wait/exit' dialogs and then finally threw the error - on second try inspector is showing only 249kB transferred (stops after fetching csv files, next on the list as pending are the form attachments) and enketo dialog is just pulsing, eventually stopped loading, no error, no content. 3rd try also stalled after csvs but then threw the error at 1.3min mark and then loaded the rest of the content. On the others the error came up straight away.
Haven't yet pulled out a form extract that can demonstrate the failure.
edit @Xiphware - you don't have any clues do you? I saw your post here on a very similar issue.
Just clarifying - I ran into this Enketo issue while designing a form that included repeat groups. I needed to populate all repeat instances using media files / CSVs (which is why I asked whether the form contained repeat groups to @iam_utkarshranjan ).
What I found surprising was that the same form worked perfectly fine on an older version of ODK Central / Enketo (around mid-2023), but it failed on newer version released in 2024.
To be honest - I never figured out the exact root cause. I even considered documenting it here on the forum, but I wasn't sure what exactly to document or explain since I couldn't pin down the "why" (all I could write was this). Luckily, in my setup, our organisation's production server was still running a 2023 version while my staging server had a 2024 release. So, even though it failed on my staging server, yet worked fine on my Organisation's ODK Central server, so.. just ignored the issue back then.
Though, I did a lil bit of research to pick up a couple of insights for the same:
This issue taught me the hard way that "NaN" and "NULL" are not the same. Some fields in my form were read as NaN in ODK Collect, while Enketo interpreted them (same fields) as NULL (or empty). (or vic-versa, I was simply confused.)
Eventually, I redesigned the form. Instead of relying on functions like instance or pulldata to bring CSV data into repeat groups, I tried a solution I found here on the forum: using selected-at to process key-value pairs from the media file. Surprisingly, that fixed the issue completely - though I still can't explain exactly for how or why it worked.
Just thought I'd share my experience in case it helps someone facing a similar situation.