Why does the Add Records thing happen and how to stop it

168
6
08-13-2020 11:37 AM
DougBrowning
MVP Notable Contributor

Whenever I use repeat count I get a lot of weird things that happen.  The biggest one is the add records thing.  If it knows it needs 4 more then just add why make me click?

I get it so much that I want to know what is going on here and how to stop it.  I had to start counting myself and adding a constraint but it would work a lot better if repeat count would behave.

In this case it is a nested repeat.

Thanks

0 Kudos
6 Replies
Philip-Wilson
Esri Notable Contributor

Hi Doug,

Are you using repeat count and the Inbox and loading existing survey records and related data?

If so, what you are seeing is expected if you have set a repeat count and the number of repeat records loaded from the Inbox does not match the repeat count.

Repeat count is intended to be a count of the number of required repeat records, it is not a maximum, but a set value of how many repeat records must exist.

Therefore if you set the repeat count to 10, and load data via the Inbox and there is only 6 records, you will see a message that 4 additional repeat records need to be added. This is because there is a mismatch in the data that was loaded and the configuration of the survey xlsx form and repeat count.

The same applies if there are more records loaded from Inbox compared to repeat count, a message will be displayed to say there are too many records and to delete the records above the repeat count.

Regards,

Phil.

0 Kudos
DougBrowning
MVP Notable Contributor

No Phil this is not from the Inbox at all.  It is a first time open.  It has been happening to me all the time with repeat count.

It seems to be on nested repeats.  Not sure if you have tested that.  I thought it was having a formula in repeat count but it even happens with a static number.

I just posted because this is about the 4th time I have had to abandon repeat count due to it not working correctly.  Esp in nested repeats.

I can send a sample form if you want.  Thanks

0 Kudos
Philip-Wilson
Esri Notable Contributor

Hi Doug,

Yes, can you please send me your xlsx file that displays this issue with "Add records" when you are creating a new survey. If you have a simple version of the survey that reproduces the issue that would also be very helpful.

I tried creating a few test surveys with nested repeats and repeat count, but each time I open the survey I get the number of repeat records created, which align with the value set by the static repeat count or calculated repeat count.

There must be something else in your form (relevant expression etc) that is causing a load timing issue with the repeat records so that they get nulled out, and therefore the "Add records" message is displayed as there is a mismatch in the repeat count value and the created records in the repeat.

Regards,

Phil.

0 Kudos
Philip-Wilson
Esri Notable Contributor

Hi Doug,

I have finally narrowed down the cause. It is related to using repeat count on a nested repeat that contains a question with a calculation that references another question in the parent repeat. It creates a timing issue with the loading of the values and repeats, which nulls out the additional nested repeat record rows after they are initially created, but before they get populated with the values.

 

We already have a known issue with repeat count on nested repeats and calculations referencing parent questions. This is another example of that same issue, which I think you have reported previously via GeoNet and I worked on it with you: https://community.esri.com/thread/241314-nested-repeat-with-repeatcount-shows-add-records-box-now

 

Unfortunately the only work around is to not reference a question outside the nested repeat, or not to use repeat count on a nested repeat. I have updated the internal backlog issue with these new findings and examples.

Regards,

Phil.

0 Kudos
DougBrowning
MVP Notable Contributor

Thanks Phil.  I am now writing out the set of fields 30 times (5 in the group so now 145 more fields than using a repeat) and then hiding when needed.  Slowing the form down but all I got for now.

It did create a new issue however.  The old bug where default values are not applied to fields that come out of a relevant.  Any update on this one?  

I guess I could try the new hidden appearance instead.  Not sure if the default works on those yet.

thanks

0 Kudos
Philip-Wilson
Esri Notable Contributor

Hi Doug,

Yes, the new "hidden" appearance will be a better option, compared to making the field relevant, not relevant, then relevant again. Defaults will work as expected on hidden appearance question types, basically it is the same as a visible question, you just cant see it on the form. This is different to hidden/calculate questions, and different to not relevant questions.

As for the default bug, this is not really a bug. When a field changes from relevant, to not relevant, to relevant again, we do not expect the default to be there, as it only gets loaded once when the form first loads. The same applies with repeats and nested repeats, and this gets more complicated with relevant and repeat count on nested repeats, and load order if very important with defaults. It is better to use a calculate instead of a default in this case.

Regards,

Phil.

0 Kudos