A) There is probably a bug related to particular conditions set in forms for Enketo. The image bellow shows the bug message after trying to load a form with these conditions.
B) The problem occurs in the presence of two minimum conditions:
A repeat_group that assumes dynamic values for repeat_count;
A select_one_from_file question nested in the repeat_group and with autocomplete appearance.
C) I tried to isolate the problem and describe it through 4 XLSforms:
test_01: contains the minimum conditions for the bug to be reproduced. The other 3 forms below contain isolated modifications made from this form. test_01 - minimal bug reproduction.xlsx (11.5 KB)
test_04: shows that the problem is related to select_one_from_file questions with autocomplete appearance, since removing the widget also suppresses the bug. test_04 - removing autocomplete (no bug).xlsx (11.5 KB)
Hello @nnsdtr,
Additional idea: Did you try to add a (normal) begin_group ⌠end_group inside the repeat, enclosing all elements, with a relevant filter ${num_rep} > 0 ?
We had other problems with dynamic repeat - e.g. when going back and setting to 0. There seem some problems with dynamic repeat_count. We always use an additional grouping inside a repeat (might be without title)âŚ
Is there a solution or workaorund for this âTypeErrorâ that @nnsdtr reported sometime ago?
Am getting this error on a form after an another select_one_from_file with autocomplete was added in a repeat_group. The form was working before that, and already has multiple select_one_from_file questions with autocomplete in the same repeat_group. The scenario in this form does not match any of the tests @nnsdtr listed (although I have encountered on of them before). Now unable to get rid of the error even after removing many of the existing select_one_from_file entries (temporarily changed them to text)
Did a javascript trace of this problem in google chrome. Sharing a screenshot of the location in javascript file form.js from where this error is flagged (âTypeErrorâ is a javascript error). Hope someone can take this further and trace the root cause
@Kal_Lam,
I tried to create a simple âtestâ form that demonstrates this problem, to share with the community. The actual form where this problem occurs is large and fairly complex and uses multiple .csv files that I will not be able to share. But am unable to reproduce the problem in a simple form with just one csv file. By the way, in my case the repeat_group count is static/fixed to 2, not a dynamic repeat count as in @nnsdtr 's case
Also, the problem seems to be connected to a combination of questions (fields) in the form. For instance, adding function once() to pulldata() function in âcalculationâ column for some other fields in the same beginâŚend group as the select_one_from_file within the repeat_group, changed the behaviour and âpartiallyâ fixed the problem (sorry for the cryptic language)
Currently, the error occurs only when the âappearanceâ of one particular select_one_from_file field (there are multiple) is set to âautocompleteâ. It goes away when the appearance is changed (to minimal). Previously, that was not enough to get rid of the error. Either the select_one_from_file field/question type had to be changed to âtextâ, or the question had to be removed completely for the error to go away. The âonce()â change described above, seems to have helped mitigate that situation
Also very important, there are other select_one_from_file fields in the same beginâŚend group of the repeat_group, that are set to âautocompleteâ and do not cause this error! Its just this one select_one_from_file field!! (this section of the form is for recording a personâs work&home addresses and has multiple dependent dropdown fields)
Still debugging this problem and trying to determine the exact combination of entries in the xlsform that are causing this error. May eventually have to use âminimalâ for the select_one_from_file dropdown appearance as a workaround. Wont be the most elegant solution, but it will (have to) do
Sorry that I am unable to share xlsform and csv files at this time for the community to test this problem
I have the same error, itâs definitely related to repeat group. Iâve sent a message to kobobox support team many times on this but no one responded to it and itâs never been fixed. (found it a bit ridiculous as there are many similar cases on the community board) I wanted to add a simple example to demonstrate this issue but canât as I am a new user, apparently..
This error appears to still be unresolved. I should note it does not seem to be an Enketo errorâthe ODK XLSform debugger that Kobo recommends you use does not find any error, and I am able to preview my form in that browser without issue. I have tried the recommended workaround (adding groups inside the repeat) with no success.
Will continue to troubleshoot and update here if I can find the bug. Kind of incredible that this was first noted over two years ago and hasnât been resolved.
Update: After some considerable time testing, I think I understand at least one underlying issue and have a workaround. This likely would resolve the problem with dynamic repeats and the problem @aaj was having, but it doesnât fix the problem @nnsdtr hadâwhen using select_one_from_file in a repeat group, I still get the ânullâ error if using the autocomplete or search appearances.
It seems at least part of the problem stems from rules governing the relationship between the parent form dataset and the repeat group child dataset:
The field referenced in the ârepeat_countâ column of the repeat group must always have a value. For example, fields with skip logic or nested within a group with skip logic will not work.
Any skip logic that applied to the repeat group must be specified within the ârelevantâ column for the âbegin_repeatâ field itself. For example, a repeat group nested within another group that is conditioned on skip logic wonât work.
Iâm not sure if these rules are intentional or a bug, but at very least, a more informative error message would be helpful, especially since ODKCollect, SurveyCTO and others donât have these restrictions. Whatâs more concerning is that it appears users are getting this null error for multiple reasons, which points to a more serious error, perhaps with how the XLSform is translated into XML.
Workarounds:
Use a calculate field (placed outside any grouping, e.g. at the beginning of the survey) to set the repeat count. Make sure repeat count (i) always has a value, and (ii) is always at least 1.
Close all groups before the âbegin_repeatâ field, and enter any applicable skip logic in the ârelevantâ column of the âbegin_repeatâ field itself.
For the select_one_from_file appearance error, the workaround I used was to just include the list within the parent form itself. However, for use cases where the list is dynamic, this is an impractical solution.
Sharing an xlsxform with some examples for reference.