Can I prevent a value from being submitted multiple times in a repeat question?

892
30
Jump to solution
06-14-2019 11:30 AM
Highlighted
New Contributor II

I have a repeat question in my survey as shown below.  

The repeat question is to document the plant species and cover class in a quadrat.  There are over 200 values for plant species and many species may be found in a quadrat.  Is there a way to prevent a plant species from accidentally submitted multiple times in the repeat question?

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Frequent Contributor II

I think your issue is the Other.  That will repeat a bunch of times.

I do this exact thing with species actually.  We use Unknown Codes but same concept.  You will have to build in an exception for the Other.

I did not test it but I added my line into your form.  You could change my exceptions from UNK to Other.

View solution in original post

30 Replies
Highlighted
Esri Esteemed Contributor

Hi Lauren,

It is possible to create a check function using an in-beta function, custom JavaScript functions. See the attached sample.

Highlighted
New Contributor II

Thanks for sharing, James.  I am not familiar with JavaScript functions, could you please provide a little more detail?

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Lauren,

In the survey is a custom function that compares the number of answers with the number of distinct answers and returns true if they are the same and false if they are not.  I based it on https://codeburst.io/javascript-array-distinct-5edc93501dc4  

Reply
0 Kudos
Highlighted
New Contributor II

Hi James,

Thanks for your response.  I added the note to my survey and added the extensions folder with the javascript file to my survey content folder.  However, now the note about duplicate values is always appearing.  Do you have any suggestions?

 

 

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

Hi Lauren,

The pulldata expression needs to be in its own hidden calculation, and then reference that question name in your relevant expression for the note.

It will not work the way you have currently tried to use it in the note.

Phil.

Reply
0 Kudos
Highlighted
New Contributor II

Thanks, Philip.  Did I do this correctly?  The duplicate value warning is still showing up all the time.  

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

Hi Lauren,

No, this is not correct. You need to remove the not and separate that to a different question from the pulldata.

Can you attach your xslx file so I can take a closer look and work out the best way to achieve what you are after.

Phil.

Reply
0 Kudos
Highlighted
New Contributor II

I have attached my xslx file.  Thanks!

Reply
0 Kudos
Highlighted
Frequent Contributor II

I think your issue is the Other.  That will repeat a bunch of times.

I do this exact thing with species actually.  We use Unknown Codes but same concept.  You will have to build in an exception for the Other.

I did not test it but I added my line into your form.  You could change my exceptions from UNK to Other.

View solution in original post