Enketo - TypeError: Cannot read properties of null (reading 'dataset')

Description

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.

image

B) The problem occurs in the presence of two minimum conditions:

  1. A repeat_group that assumes dynamic values for repeat_count;
  2. 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:

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)

@aaj, could you also share your XLSForm and the CSV file so that the community could test the same at their end?

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

thanks and regards