Triggers not working on Groups on ODK Collect

1. What is the problem? Be very detailed.
We have a form with a dynamic default (i.e. calculation + trigger columns) that is working fine on Enketo. However, on ODK Collect (v.1.30.1), it is only working for the questions within the same group. The form uses If Statements to pre-fill the questions that are in the same group as the root calculation.

2. What app or server are you using and on what device and operating system? Include version numbers.
ONA is the aggregate server. Enketo version: version:2.5.6-b806da5-0494858

3. What have you tried to fix the problem?

  • Tried to remove the groups. The form seems to work on ODK Collect when the groups are removed

4. What steps can we take to reproduce the problem?

  • Uploaded the form on Ona
  • Launched the form on Enketo. The form works as expected
  • Opened ODK Collect on an Android Mobile Device
  • Downloaded the form with https://odk.ona.io as the server URL
  • Ran the form and noticed that the trigger was not working for the questions in the group that followed the question referenced in the trigger column.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
Attached is the XLSForm
matrix_test.xls (20.4 KB)

1 Like

Hi, had this problem as well, can anyone support? Is this an ODK app bug? Is there anything we can WITHOUT changing the form structure?

I.e. we know we can add calculates to the groups referencing earlier question, and then use this, but would prefer not to create multiple duplicate columns in the export.

Anyone who can provide support on this issue?

It seemed to work (in Enketo and in ODK Collect if I deleted the trigger from the questions inside the group group_qm6di55. Is it intended that the user can change the value to something other than "no info"? If the answer should always be "no info" for those questions - did you consider using relevant to control which questions the user can answer?

Also I think L22 (if(once(${group_kb06p35.Quick_visit_only_Ho_neficiaries_observed})=0,'no_info',''))
should just be
if(once(${Quick_visit_only_Ho_neficiaries_observed})=0,'no_info','')

Hi, thanks @danbjoseph for your support, apologies for the super late reply. Only found time to come back to this issue now.

  1. No, the answer could be "good" or "bad", just most commonly "no info". So relevant doesn't fit the use case.
  2. Thanks, this works, BUT we cannot finalize and submit the form. When you finish the form and try to finalize it takes you back to the initial question (e.g. BSFP Distribution) and now it appears empty. This happens no matter what value you enter in the ${Quick_visit_only_Ho_neficiaries_observed} field.

I've tried:

  • calc: if(once(${Quick_visit_only_Ho_neficiaries_observed})=0,'no_info','') ; trigger: empty
  • calc: if(once(${Quick_visit_only_Ho_neficiaries_observed})=0,'no_info','') ; trigger: ${Quick_visit_only_Ho_neficiaries_observed}
  • calc: if(once(${Quick_visit_only_Ho_neficiaries_observed})=0,'no_info',${BSFP_Distribution}); trigger: ${Quick_visit_only_Ho_neficiaries_observed}

FYI I was able to make the default calculation in the form work by using if(once(${Quick_visit_only_Ho_neficiaries_observed})=0,'no_info',null)

The form successfully pre-loads "no_info" when no. of beneficiaries is equal to 0, and has no selection when no. of beneficiaries is higher than 0. Both are submitted to the server successfully.

However, new problem: the default calculation is overriding the user choice.
E.g., no. of beneficiaries is equal to 0. This pre-loads "no_info" as a default answer. The user changes the default choice to another selection, for example "good". The user successfully submits the form. But when I download the data, I see "no_info" even though the user changed the value. In practice the default is acting like relevant, which is not what I need.

Any ideas on how to fix? @Evans_O maybe you know?

@danbjoseph , @Daria_Gordina I tried to make the form smaller as attached.

I also tried removing the groups, removing the trigger column, removing audit (the metadata field) and also the appearance attributes but it still doesn't work. It seems to work on Enketo but upon testing on ODK Collect, it doesn't. I suspect it's a bug on ODK that may be causing the issue.

testaleppo.xlsx (91.4 KB)

Thanks for the report and apologies for losing track of this one. There's a fix in the latest v2022.3 beta that we'd appreciate feedback on. CC @ahblake who also ran into this recently.

There's some risk to the fix around repeats and dynamic defaults, especially when using nested repeats. If you have forms that use dynamic defaults that are NOT set from within the same repeat instance, please send us the forms so we can add them to our test suite.

1 Like

2022.3beta has fixed this for me on a Galaxy S5 with Lineage 18.1 / Android 11.

I have a dynamic default via a triggered calculate in a group different to the trigger value, this previously worked in Enketo and not Collect.

Now the dynamic default is set when triggered, and if changed, it is not recalculated on submit.

1 Like