Repeat Always Creating Record

6340
29
Jump to solution
01-03-2018 08:16 AM
ShawnRoberts1
Occasional Contributor

I'm just experiencing a weird issue that hasn't occurred in the past. Normally, for a repeat a record would only be created in some data was actually entered into the repeat( or an image added). However recently I've experienced an issue with any new surveys that no matter what a record will be created in a  repeat, no matter is it is completely blank or no image has been attached ect. Has anyone ever experienced anything like this before?

I created a really simple survey to test with two lines and this still seems the be happening. The main table (0 index) will be created as expected, then no matter if there is no image or not a record will be created in the related table. 

This is causing alot of headaches as I run scripts/workflows against the survey results and it keeps returning blank records (or in this case records with no attachments).

Any advice/guidance would be greatly appreciated.

Thanks, 

Shawn

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Andy/Shawn,

I believe the reason you are now both seeing different behaviour to previous versions, is due to changes that were made recently to support the Inbox and editing of repeats. As you may already, know we now treat null values in questions differently to enable editing existing features and related table records, and this why the blank rows get created if you have set a repeat count or have calculations.

Phil.

View solution in original post

0 Kudos
29 Replies
ShawnRoberts1
Occasional Contributor

To add a bit more to this. It seems to be in the repeats. For any repeat that exists within the survey, it will always create a record in each related table (even it there is no attributes filled out in the record aside from the Id's). I'm looking back at some older surveys we've published out before and this is not the case. If the information was not filled out for a repeat it did not create the record. I use some scripts to look at the surveys and pull all their data and attached files/images into a report. However, with blank records being created now its creating a lot of issues looking for data and returning results with nothing attached (ex for loop - for each related record in images grab its attached image. However now records are being created with no images attached as no one asked for it to be created).

0 Kudos
by Anonymous User
Not applicable

Hi Shawn,

This is the expected behaviour for repeats if no appearance has been applied, the intial record will be created on loading survey. If you set the appearance of the begin_repeat to minimal the initial record in related table will not be created until the  sign on the repeat is selected.

Note that in some cases if you add a calculation or default to one of the questions in the repeat it will also create the initial record on loading or re-calculation.

Regards,

Phil.

AndyZeigert
New Contributor II

I've noticed this behavior as well. It seems to have started when I tried to use a field from the repeats in a later calculated field. Basically, "calculate total x for all repeats". Now records for all repeats up to the repeat_count setting are being created, which creates a lot of empty rows in a table on our report.

0 Kudos
by Anonymous User
Not applicable

Yes, this is to be expected. Setting a repeat_count for the repeat will cause all the records to be created in the related table on loading the survey.

Phil.

0 Kudos
AndyZeigert
New Contributor II

The calculation isn’t inside the repeat, it’s in a field later in the form. The repeats don’t have any calcs within. Still expected?

0 Kudos
by Anonymous User
Not applicable

Hi Andy. Sorry I updated my reply as the calculation issue confuses the issue, yes still expected, if you use repeat_count that will set how many records are created in related table at the time that count is set, this is expected. It is not a maximum number of repeat records allowed but a number or records to be created.

To avoid the issue of blank records being created in related tables you need to use the minimal appearance on repeat and not use repeat_count.

Phil.

0 Kudos
AndyZeigert
New Contributor II

That makes sense. Although I only recently added the new calculated fields. Before that, the repeats still had repeat_counts and were set to minimal, but we weren't getting those extra blanks records. I'll do some experimenting.

ShawnRoberts1
Occasional Contributor

Hi All, I ended up using the minimal appearance to fix the issue of creating blank records. Why is it that the record is created by default unless the appearance is set to minimal. It almost seems to make sense to have the option set elsewhere to have the record created by default or not. I found myself digging through the schema's to try to find the option, before posting this question, but never would have thought the appearance would affect it It may also be useful to have something in Repeats—Survey123 for ArcGIS | ArcGIS  about repeats creating records by default. 

Thanks, for all your assistance!

by Anonymous User
Not applicable

Hi Andy/Shawn,

I believe the reason you are now both seeing different behaviour to previous versions, is due to changes that were made recently to support the Inbox and editing of repeats. As you may already, know we now treat null values in questions differently to enable editing existing features and related table records, and this why the blank rows get created if you have set a repeat count or have calculations.

Phil.

0 Kudos