Select to view content in your preferred language

Survey123 Survey Crashing on iPad (related to calculate field that counts a repeat)

767
10
05-16-2024 02:40 PM
JonCardiello
New Contributor II

My team recently encountered a bug in our Survey123 Survey that I wanted to share here to see if anyone else has experienced similar issues, and to possibly report the bug to the software team.  

Details of workflow:

The buggy behavior on iPad that we have been experiencing is that in one of our surveys in the Survey123 field app keeps crashing after 5-10 photos have been taken, losing all data.  It also has a slow processing behavior where it won't render the first tap on the screen but then processes it after the second tap.  This lag creates a difficult UI for entering data and results in data errors. 

I was able to narrow in on the lines in my xls form that were causing the issue and get our survey back on track. I realized that it was just the presence of a calculation field within a repeat that is counting the number of repeats.  When moved to outside of the repeat itself, the issue goes away. 

After more troubleshooting though I am realizing that it is slightly less simple than I thought. After testing it more, it seems as though when the survey only has one or two repeats, the bug isn't present even if the calc field is within the repeat.  I created some generic forms to demonstrate the issue.  Here is the breakdown of the files I am attaching:

  • V1.0 only has 1 repeat with the repeat count field within the repeat (no bug present)
  • V1.5 has 3 repeats with the repeat count field within the repeat (bug present)
  • V2.0 has 3 repeats but with repeat count field moved outside of repeat (no bug present)

I am hoping that maybe this can help someone else who might be trying to do a similar thing in a survey.  Also maybe by logging this it can get flagged as a bug to maybe bring up a syntax error without letting the user publish a survey that will result in data loss when used in the field.

System Details:

Publishing a survey from desktop Survey123 Connect on PC Windows 10 (version 3.19.116)
Running into bug on iPad iPadOS (17.4.1) on Survey123 Field App (v2.19.121)

 

Tags (1)
10 Replies
DougBrowning
MVP Esteemed Contributor

Are you trying to run a counter to use in a photo name or something like that?  If so I use once(count()) so that it just fires once and does not mess things up if they go back in the repeat.  I see you do not have once and are setting calculate to always.  I could see this creating a loop inside the repeat.  I also not sure what the use case would be to need this.  I sum up nested repeats a lot and have been ok.  I have been having this issue with position though.  If you let the form run in Connect are you seeing the little warning mark show up at the top right (you have to leave the form run for a few mins to see it and I have to say it was news to me as I tend to go through the form fast.).  Have you made a log file yet?  Try one and you will probably see it is huge just running and running.

Not sure your use case or I could give you a better workaround as I have been battling this back and forth for years now.  I am heading out the door for a few weeks so sorry I cannot answer but others may, so post the use case.  It may get fixed but probably not so looking for ways around it is the way to go.

Hope that helps

0 Kudos
abureaux
MVP Frequent Contributor

I've encountered this a lot. It's a bug and Esri is aware of it... will try to dig up the code if you want to link to your account.

EDIT: found it quicker than I was expecting. BUG-000162468 In the ArcGIS Survey123 field app (version 3.18.145), iOS devices do not display the next page after clicking the next page ‘>’ icon.

EDIT2: In case it wasn't clear, that text is from Esri's brief description of the issue. This bug persists in 3.19, and it may have been present in versions prior to 3.18.

The only real solution is to pull items out of the survey until the issue goes away. Then, you can work at adding content back in and try to work around the bug.

This is a very dangerous bug since it crashes without saving anything... really hope Esri repairs this one soon.

SMH-Rio
Occasional Contributor

I encountered a similar issue calculating position(..) in a note, inside a repetition with relevant, creating a new record with pre-filled questions through a custom url. In this context, the form, in Field App, keeps loading, freezes and never finishes loading (Connect v.3.20.63 and Field App 3.20.68)

When removing the calculations from the url, everything works fine. When removing the position(..) and keeping the calculations in the url, it also worked.

As a workaround, I hid the question that has the position(..) calculation and displayed the repetition index in another question, as described in the bug mentioned by @abureaux . The once(count(${name})) described by @DougBrowning did not work in my workflow, but it may be a possibility in other scenarios.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Note if using once(count(${name}))  name must be a field that is always filled out.  So I use a hidden field with a default of 1 and a calc of 1 - you have to have both or it will not work as well.  I use this in 10+ forms now and all working ok now.

0 Kudos
SMH-Rio
Occasional Contributor

Yes, you are right. Initially, I tested counting the repeat itself, not any other field. The way you suggested worked. Thanks.

Also, after some more testing, I realized that both position(..) and once(count(${repeat})) only freeze the Field App when they are in a text question. Changing the question to integer stopped freezing the app.

In other words: for some reason, counting the repeat itself or using position(..) in a text question, in my workflow, freezes the app. The app does not crash when using numeric questions or counting a question other than repeat (including in a text question).

DougBrowning
MVP Esteemed Contributor

The 123 team had me try integer type also but my form still displays the warning in Connect.  It could be that I have several repeats and some nested, not sure.  Note the form did seem better at first but if I let the form sit a minute or so in Connect I get the warning here.  I would test this on your form just to make sure.

DougBrowning_0-1723034296886.png

Thanks for all the testing.

0 Kudos
SMH-Rio
Occasional Contributor

Using position(..) or count(${repeat}) in a text field, I get this alert with a circular references (loop) message. Changing the field to integer, the alert disappears.

From what I can see, there is a problem with the number to text cast in a workflow that has relevant repeat + custom url. In any case, changing the field to integer solved the problems, for now.

It's just a shame that it took me a few hours trying to find the reason for my application freezing 😂

0 Kudos
DougBrowning
MVP Esteemed Contributor

Weird I get mine on integer still.  

0 Kudos
SMH-Rio
Occasional Contributor

I think it has to do with the relevant in the repeat. When I remove the relevant and add a record, the alert reappears. However, even with the Connect alert, the Field App works normally, without freezing (if I keep the field as an integer).

I believe that this circular reference alert will always appear using some counter inside the repeat. I just don't know why, since position(..) has exactly this counting function. Freezing the application when I use the counter in a text field doesn't seem very functional to me either.