NoDuplicates within Double Repeat - Issue

Hi All,

I am using a double repeat to collect information on the number of counts during a survey and then recording the types of species and number of each, for each count.

I am trying to limit the duplicate selection of the species within each count, but not between counts. I seem to have got it somewhat right but not totally.

The no duplicate works fine within each count, and allows selection of the same species on the second count if I select the species in the same order, however, if I select the last species from the first count as the first species in the second count it recognizes it as a duplicate selection even though it is in a second repeat count.

For example

Count1
Species
Yellow
Orange
Blue
Count2
Species
Yellow
Orange
Blue
this works fine, however the following does not work:

Count1
Species
Yellow
Orange
Blue
Count2
Species
Blue
Orange
Yellow

the basic structure is (file attached)'
RepeatCount
RepeatSpecies
Species_ID
Species_Number
End RepeatSpecies
End RepeatCount

The code i am using in the constraint field of Species_ID is
not(selected(join(' ',/Repeat_NoDuplicates/RepeatPass/RepeatSpecies[./GRepeatSpecies/Species_ID and position(.) !=position(current()/../..)]/GRepeatSpecies/Species_ID),.))

I would appreciate any advice on finding the probem.

Regards,
Repeat_NoDuplicates.xlsx (17.0 KB)