restrict list choices in a repeat's "select one" question based on choice selected in a previous repeat

1777
11
01-25-2022 02:21 PM
Galen_S_MnDOT
Occasional Contributor

Hello-

I have a sign inspection form that incorporates cascading selects across three nested repeats.   Depending on the type of inspection selected (which corresponds to the type of structure), the user is provided a filtered list of structural elements.  Depending on the element they then select, they're provided a filtered list of relevant element defects to assess.

Although the cascading selects work just fine, and the form also locks the number of repeated element and defect records depending on the previous selection, I haven't yet figured out a way to prevent users from accidentally selecting either the same element or same defect twice. 

I do have an "assessed defects" checklist question (read-only "select_multiple" question, uses the join() function) visible for each element:

Galen_S_MnDOT_0-1643149076702.png

... and a similar "assessed elements" checklist for the entire inspection itself, but this method still requires user oversight, and if an element or defect is repeated, I don't know how to indicate to the user specifically which choice was erroneously selected twice.

Is there a way to remove options from the initial "select one" questions for subsequent repeated records based on what's already been selected?  That ability would eliminate this possibility for user error and ensure that each element and their corresponding defects are assessed only once.

Thank you for any assistance!

Galen S.

Minnesota Dept. of Transportation

0 Kudos
11 Replies
DougBrowning
MVP Esteemed Contributor

This has been posted a few times and as far as I know my hack to yell at them if they do dup is the only method so far.  Except there are some javascript ways also but that is not an option for me.

See here  https://community.esri.com/t5/arcgis-survey123-questions/how-to-not-use-a-list-item-more-than-once/t... 

Galen_S_MnDOT
Occasional Contributor

Understood - thank you Doug! 

JS not an option for me either, unfortunately.  I looked at the technique described in your linked post, and I don't think that'll be an option either since there's a high likelihood of backwards and forwards progress through the repeated records in our form.

0 Kudos
DougBrowning
MVP Esteemed Contributor

That should not matter we can add in any order of the 6,000 in our list and it works fine.

Galen_S_MnDOT
Occasional Contributor

Ah, I must have  misunderstood that other post then.  I thought I read that the method breaks if user clicks back through any already entered repeated records.  

However, I'm testing another possible method at the moment that looks promising; I'm using each choice/type's expected position (index) in the repeat list inside the choice_filter expression so that for every repeat, only one unique choice is available. 

I'm not sure if this would be workable for a choice list as long as yours, since I had manually assign the desired repeat index values to every individual choice for our first and second level repeats:
Screenshot 2022-02-02 103050.jpg

 

 

 

 

 

... but that wasn't particularly burdensome, since our longest choice list is only 193 items.

But it seems to work!  The one potential obstacle we've identified so far is that the position(..) function that actually populates the stored index values for each repeat seemed to be a little unpredictable during some previous testing, but I think I may have solved that by having the two nested repeats appear at specific times using Relevant expressions.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I think the order of the selections is the order they clicked on the boxes and not the order of the list.  So if they select the last item first it gets a 1.  So they could have the exact same selections but the selected at would all be different.

If you post your form I may be able to help more.

Galen_S_MnDOT
Occasional Contributor

Excellent, thank you!  I'm curious to see what you think of it:

0 Kudos
DougBrowning
MVP Esteemed Contributor

Sorry this thing is way too big and complicated for even even to tell what you want.  I am not even sure how to create a dup.  Also your list values are all numbers which makes it harder.

Then there are so many nested repeats it is hard to tell where the check should be.  You need to use join outside the repeat.  Then if there is a nested you may have to use join twice to get them all.

I added the code I use hopefully you can adjust it to be in the correct spot.  Line 192.  You may want to break out a section for testing vs this big one.  

Sorry I was not more help.  This code works for me so hopefully it will help.

0 Kudos
Galen_S_MnDOT
Occasional Contributor

Heheh, totally understand Doug.  Making any sense of it definitely requires a fairly nuanced understanding of overhead sign design parameters and inspection requirements.  Thanks for even being willing to take a look!

0 Kudos
DougBrowning
MVP Esteemed Contributor

Coming back to this since I wonder if you were using the new 3.14?  The new calc engine broke my trick but then I found a fix for it.  

Here is a simple form I made to show how it works.  Prevents you from adding dup species.  Had to add the once() around the join for the new engine.

Hopefully you can follow this example and get it to go.