Position (..) according to if() condition

Hello everyone,
I apologise if this subject has already been covered extensively here but even after searching, I couldn’t find it.

I’d like a calculate field that counts the position according to the response to a condition included in a repeat_group, for example
if(${obs_nid_gp} = ‘nid_frais_oui’, 1, 0)
If 1, position(…) counts, otherwise it doesn’t.
I’ve naively tried a few things like this, but it doesn’t work:
if(${obs_nid_gp}=‘nid_frais_oui’,position(…),‘’)

Here a visualisation of my data

If someone have already traited this kind of functions…
Thanks !
Samuel

@Samuel1, here is a simple use case of the same that should help you understand on how the same can be used:

And this post too …

Hello Kal,

Thank you very much for your reply.
I believe your suggestion isn’t quite applicable to my situation.

What I’m looking for is a final and specific identifier generated by concatenating several other variables. One of these variables must be a serial number calculated based on specific conditions.

How can this be achieved? Initially, I thought about using the position(..) function, but none of my attempts have worked.

This involves a repeat loop where each nest is recorded based on different variables. Specifically:

  • Var 1 is “chimpanzee or gorilla” (no other options), AND
  • Var 2 is “the nest is fresh” (no other options).

This means the count is only affected by this condition and not by any other criteria.

Thanks !