Select to view content in your preferred language

Constraint not working and I can't tell why.

933
9
03-24-2024 05:18 PM
NicoleCarter
Emerging Contributor

In line 63 of the form I have a constraint. My intent is for it to check previous plant entries and if there is a duplicate, return a message saying "hey you already added this." However I copied the formula from a different form and I think something is off, it hasn't worked so far and I can't tell why. 

0 Kudos
9 Replies
DougBrowning
MVP Esteemed Contributor

This is my code so I hopefully can help.

You need to add a once on line 63 like this 

once(join(", ", ${Species}))

Line 64 also needs a once

once(count(${species}))

Try that

0 Kudos
NicoleCarter
Emerging Contributor

Hi Doug! I tried that and it didn't change the result, I am still allowed to enter the same plant multiple times. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

mm can you post the species csv so i can test,  you prob dont use unknown codes

0 Kudos
DougBrowning
MVP Esteemed Contributor

Oh you have this outside the repeat, it needs to be inside.  Move end repeat down below line 65

0 Kudos
NicoleCarter
Emerging Contributor

Both of those seemed like it would do the trick, but neither of them did it. I can still add Abies Balsamea to my heart's content.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Weird I have it working in 3 different forms.  Post your species list csv so I can test.

0 Kudos
NicoleCarter
Emerging Contributor
 
0 Kudos
DougBrowning
MVP Esteemed Contributor

I added the once and moved the end repeat and it is working just fine for me.  Took out the XXXX to make it simpler (we use that for Unknown plants)  Not sure where you are off.

See attached.

Also I suggest changing your plant list to have name as the USDA code and the label be this with 4 spaces in-between each.

USDA Code    Scientific Name   Common name

That way you store the codes in the data making downstream use way easier.  Also it allows the crew to search by any part of the name they know.  For example they know its a fir and can quickly narrow the list.

This is what we do

DougBrowning_0-1711401121958.png

This looks like a wetland survey?  Are these islands BLM by chance?  We shared our forms to the MI people doing the same on their islands.  We have a whole set of Wetland forms.  I can share just reach out on PM.

Hope this all helps. 

 

 

0 Kudos
NicoleCarter
Emerging Contributor

THANK YOU so much! Yes, it's wetlands, BLM islands, in Minnesota. I'd love to see their forms.