Duplicates control inside nested repeats

Dear All
I hope all is well with you.
Am currently working on a form in which i want to control the entries entered in a question within nested repeats

There is a repeat group -netcodes and within it there is another repeat group called membercode.
Inside membercode group there is a questions ‘code’ which i want to control its entry. Meaning i want all entries of ${code} to unique across ‘membercode’ repeat group , across all instances of ‘netcodes’ repeat group

I tried a lot of tricks but 'count(../../../netcodes/membercode/code[. = current()]) = 1’ was promising and worked perfectly in enketo web but on odk collect am getting error [Collect cannot handle current() function

Attached is the form that is working in ENKETO web but not in ODK Collect app

Kindly advise on what can be done

Regards

duplicates in nested repeat.xlsx (10.0 KB)

Hi @Philipo_Ruzige

This should work I believe:

duplicates in nested repeat.xlsx (9.4 KB)

@Grzesiek2010
This is EXACTLY what I was trying to accomplish. I tested the form on both Enketo Web and the Collect App, and it worked flawlessly. I had already given up, thinking it was impossible. Thank you so much for your time and dedication — you’re a lifesaver!