Error in calculation in repetition group

I have the error of "cannot convert multiple nodes to a raw value. Refine path expression to match only one node", this formula "count(instance('casedb')/casedb/case[@case_type = 'individuos'][codigo_unico = /data/miembros_hogar_/miembros/codigo_unico]) = 0" in a repetition group, how do you think I can correct it?

image

it seems your code is not unique

basically it is getting more than one result with that filter. you want to make sure your filter returns exactly one result.
or
you can do something like Join(" ", your query) and it will return all the results in a space separated list

thanks for your answer

reviewing the criteria, the error is in the repeating nodes, since I am creating child cases counting unique codes. I would understand that I should add current() in the repeating property which would be /data/miembros_hogar_/miembros/codigo_unico. I tried to add it before the property but it does not identify it, I did something like that:

"count(instance('casedb')/casedb/case[ @case_type = 'individuos'][codigo_unico = current()/..//data/miembros_hogar_/miembros/codigo_unico]) = 0".

Am I using the current where it is not?

The only way to really be able to tell is to see your form structure.
the current and parent functions act as a pointer where the parent function moves the pointer one level up each time you use it

so current()/../elements will point at the elements inside the repeat.
if the element you want to pull is inside a repeat that is larger than the repeat you're in, then you want the current parent or the parent. so current()/../../ instead

let's look at this

  • Repeat1
    • element1
    • element2
    • REPEAT2
      • element3
      • element4
      • hiddencalculation

if you want to pull element3, you use current()/../element3
if you want to pull element1, you use current()/../../element1

you're gonna have to try out a few different combinations and see which one pulls the value you need