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

1905
32
Jump to solution
06-14-2019 11:30 AM
LaurenMcGarvey
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?

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Frequent Contributor

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

32 Replies
JamesTedrick
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.

LaurenMcGarvey
New Contributor II

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

0 Kudos
JamesTedrick
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  

0 Kudos
LaurenMcGarvey
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?

 

 

0 Kudos
Philip-Wilson
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.

0 Kudos
LaurenMcGarvey
New Contributor II

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

0 Kudos
Philip-Wilson
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.

0 Kudos
LaurenMcGarvey
New Contributor II

I have attached my xslx file.  Thanks!

0 Kudos
DougBrowning
MVP Frequent Contributor

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