Help modifying formula

hello I made this form and I searched the forum for an answer for repeated values and it works fine for me but now I want to add a begin repeat I couldn't make it work can someone help me modify it or understand the levels ../


this is the formula that works it has begin repeat ESCANEO and begin_group Escaneo and looks for the value in ESCAN2

not(selected(join(' ',/mega2.0fila_mensaje/ESCANEO[./Escaneo2/ESCAN2=current()/../ESCAN2 and position(.) != position(current()/../..)]/Escaneo2/ESCAN2),.))

The formula I want to do is image 2 I added a begin repeat inicio

not(selected(join(' ',/mega2.0fila_grupo_forum/inicio/ESCANEO[./Escaneo2/ESCAN2=current()/../../ESCAN2 and position(.) != position(current()/../../..)]/ESCANEOEscaneo2/ESCAN2),.)))

It looks like you are trying to avoid duplicates across repeat instances. When you add the outer repeat inicio, do you want to prevent duplicate values for ESCAN2 just within the current inicio instance or across all instances of inicio?

Can you please share your XLSForm?

I would like to scan many codes "inicio" it allows me to decide how many at a time I will scan I would like everything that is scanned in ${SCAN2} only to be scanned 1 time in all repetitions I achieved it when I had a begin repeat only and begin group now that add inicio I can't find how to express it anymore.thanks for your time
forum.zip (277.5 KB)