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?
Solved! Go to Solution.
Hi Joseph,
If you can please share your xlsx form and also the JS file, and any other files in the media or extensions/scripts folder, then we can try and reproduce your issue and give suggestion on how to configure.
Phil.
Phil,
Attached are the files. There are several things that I would like to accomplish and they may all be related:
Thank you for taking a look at this, please let me know if you need more information,
Joey
Hello Phil, I was wondering if you had a chance to look through what I sent you the other day. Again, I appreciate your help.
Thanks,
Joey
Good Morning Phil,
Sorry to keep sending messages, but I am starting to get desperate to learn if you will be able to help me or not. Some of the questions I asked are important for me to move forward with the development of this Survey123 app for field data collection.
Respectfully,
Joey
Philip, could you share how you solved Lauren's issue? I put the the not(pulldata('@javascript', 'repeats.js', 'distinctCheck', ${species})) function in a calculate question then used a note question with a relevancy based on the calculate question but this still is not working for me
Hi James,
I have been waiting for a response from another ESRI staff and I am not sure what happened, but I haven't heard anything in days.
I am creating a Survey123 form for collecting quantitative data on plant species. I am having the exact same issue working on a very similar survey. I am trying to provide a warning if the data collector tries to add the same species twice in one plot. I have added the distinct_check java script and the message is always on. Could you possibly explain to me how to organize this code correctly in the Survey123 Connect spreadsheet to only show the message when there is a repeat?
I would also, like to add the following funtionality:
I attached a .zip folder and sent it to Phil, see this thread. Is there someway you could help point me in the right direction for adding this functionality?
Thank you,
Joey
The 123 team does this board on their own time so it is not an instant answer.
limit duplicate species ${plant_key} in the same plot, either by not allowing or flashing warning
- See my post below. My method is not fancy javascript but it has been working for me for years now (before javascript existed). I use it for species as well.
keep a running total of all plants collected for each transect, by species ${s_name} and publish those results in the
multiline note element on the belt transect group
- You can use join() to get a list of all the species picked throughout the repeat. It will not count the number of each type however. That is not possible currently. Depending on the size of the list you can add lines like if(species1, 1, 0) and then count that value. But really a count is analysis and is porb better to run after the fact. This is also good to do after the fact due to data changes. If anyone removes or adds a plant later in the web map or the db then your counts are all wrong. We took many calcs out of our forms for this reason.
limit the user from collecting more than 100% cover ${percent_cov}
- Just add them all up in a field and put a constraint on the field
field : total
calc: int(${BankVeg}) + int(${BankCobbleCover}) + int(${BankLargeWoodCover}) + int(${BedrockCover})
constraint: .<=100
Hope that helps.
Hey Doug,
Thank you so much for helping me with this. I don't use this site often and wasn't aware that the ESRI Survey123 team provides assistance on their own time.
limit duplicate species ${plant_key} in the same plot, either by not allowing or flashing warning
- See my post below. My method is not fancy javascript but it has been working for me for years now (before javascript existed). I use it for species as well.
-- I have included your method in my app already and I am not certain I am using it correctly. The issue I have been having is that my species codes are 14 digits, there are 2075 plants currently in my plantlist and it took 14 characters to have unique plant_key codes. So I am not sure how many characters I can strip off the code and still have a match. I may not be looking at this correctly.
keep a running total of all plants collected for each transect, by species ${s_name} and publish those results in the
multiline note element on the belt transect group
- You can use join() to get a list of all the species picked throughout the repeat. It will not count the number of each type however. That is not possible currently. Depending on the size of the list you can add lines like if(species1, 1, 0) and then count that value. But really a count is analysis and is porb better to run after the fact. This is also good to do after the fact due to data changes. If anyone removes or adds a plant later in the web map or the db then your counts are all wrong. We took many calcs out of our forms for this reason.
-- Excellent!! This should work great for me. For this section I am looking to get the s_name (scientific name) in a comma delimited mutiline note. I will not need to sum or count the number of individuals for this, but it would be awesome if this list did not include duplicate entries. Do you have any idea how to do that?
limit the user from collecting more than 100% cover ${percent_cov}
- Just add them all up in a field and put a constraint on the field
field : total
calc: int(${BankVeg}) + int(${BankCobbleCover}) + int(${BankLargeWoodCover}) + int(${BedrockCover})
constraint: .<=100
--This should work. I will follow up later and let you know.
Thanks,
Joey
My Species codes are just 4 letters like USDA plants does. But it should work the same. You are only taking off the chars so that it does not find itself in the current repeat. Even if you took just one char off it would not match that one but would match the rest. Just do less than 14 and it should work.
There is no way for join() to remove dups but if you never allow them in using the above then it should not happen. Not sure I get your question here.
Hope that helps.
Hey Doug,
How did you create your plant codes? Or did you just use USDA codes?
To better explain the situation. My quantitative monitoring protocol is set up along a 100 meter transect. Each 100 meter transect has 10 1x1m plots. Once complete, the protocol calls for walking belt transects 5m on either side of the main transect recording any additional species observed, that were not previously observed in the 10 1x1m plots.
So my idea was to generate a running list of plants collected for the entire transect and publish the list in a multiline note box (outside of the plots repeat) on the data entry form that persists until all the data for the transect is submitted. I have my surveys setup to submit after each 100m transect.
Does that make sense?
Joey