Limit Repeat when Using Related Feature Service

827
10
11-19-2020 03:57 PM
icf_Eric_Link
New Contributor III

Hello, I currently have a form created in Connect that utilizes a relational feature service.  The form collects new data for the related table.  I have a repeat setup to add data to the related table and would like to limit it to only allow 1 record to be entered.  Does anyone have an idea as to how this can be done?

 

Thanks!

0 Kudos
10 Replies
Chris_Counsell
Esri Contributor

Hi Eric,

We can add repeat counts to limit the number of repeats entered:

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformrepeats.htm#ESRI_SECTION1_1FC4AD92...

 

Cheers,

Chris

0 Kudos
icf_Eric_Link
New Contributor III

Thanks Chris for your quick response.  I have tried adding a number 1 to the repeat_count however, I get an error stating that there is not a matching field in the existing feature service.  Is there a way to enter this value without having to have a matching field in the data?

icf_Eric_Link
New Contributor III

form.JPG

0 Kudos
Chris_Counsell
Esri Contributor

Thanks. That warning may be unrelated - did you add additional questions (i.e. fields that weren't included in the original feature service schema)?

Also please note you have two data validation issues with the names - 'Date' is a reserved word and row 2 is too long (keep field names under 30 characters)

0 Kudos
icf_Eric_Link
New Contributor III

Thanks for catching the Date issue.  Regarding the length of the field names row 3 is the name of the existing feature service I am connecting to and row 15 is the name of the related table.  I have not added any new fields that were not included in the existing feature service.

When I delete the "1" from the repeat_count cell I can successfully publish the form so I'm thinking entering a value in the repeat_count cell is some how causing the problem.

 

Thanks 

0 Kudos
Chris_Counsell
Esri Contributor

It looks like the repeat_count is stored in the parent table schema as a field. Further discussion and solution here:

https://community.esri.com/t5/arcgis-survey123-questions/survey-123-repeat-count-not-allowing-to-pub...

@Alber_Verster  

icf_Eric_Link
New Contributor III

Thank you Chris.  I'll take a look.

0 Kudos
Chris_Counsell
Esri Contributor

After looking into this issue more and understanding exactly how repeat_count works, when using a static value in the xslx form for repeat_count, a new field will automatically be added to the feature layer to store the value entered. This is required so that the field app can retrieve the stored value to then load the correct number of records in that repeat.

 

Therefore you will need a field in your feature layer called ${repeatname}_count where the ${repeatname} is the name of your begin repeat question that has the repeat_count applied. This can be created as read only and even hidden so that it is not displayed on the form in the field app.

This expains why we are getting prompted around adding a new field.
As it's a feature service, I believe the solution would be to add a field to the original service called {repeatname}_count, where repeatname is the name of the related table.

Please let us know how you go.

icf_Eric_Link
New Contributor III

Hey Chris,

 

Thanks for looking into this and providing a solution.  It sounds straightforward and I'll let you know if I have any issues.  Thanks again!