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)

@pruzige, this post discussed previously should help you solve your issue:

@Kal_Lam thank you very much for your efforts. The trick from the link you shared work, however i have a different case in which the in need to control the duplicates on a question in the inner group which is nested in the outer group.

I hope the form i attached earlier will shed more light to what am struggling with.

Regards

At last i found what is was looking for

duplicates in nested repeat (2).xlsx (9.4 KB)

credits to: Profile - Grzesiek2010 - ODK Forum