I have an integer question (Question 2) inside a repeated group. I know how many times the repeated group will be repeated (repeat_count) is based to an answer of Questio1.

Let’s say that the number of repeated group will be 6, and the Question 2 (which is inside the repeat) has the follow answers:
6 / 5 / 11 / 3 / 15 / 1

so my question is:

Is there a way to know the max value (input) had be entered to the Question 2 (from all over the 6 repeats) ? (which is 15 in this situation)

I will add Question3 as select one yes/no and this question will be inside the repetition.

How can I say (outside the repetition),

Find the Max value of Question 2 with (Yes) response to Question 3, if the max value repeat has answer (no) to Question 3, then find the the next Max value with answer Yes to Q3 if not then keep looking till you find max with yes and once you find the max value with Yes response give the repeat index

Sorry for such confusion if there is any. Your help much appreciated.

Here is the issue and the solution for the community, credit to @MohammedTaleb with namy thanks.

The issue:
We need to know the eldest child’s age and gender from a repeated group, so we can force the entries in later group to be exactly the same as the entries in the repition.

The count of the repition based on an integer answer.
The age question inside the repition is >= 3 and <= 22.
The gender select one only male and female
There is a question if there is a disability or not.

The later group of questions is asking for the eldest child in the 5-17 age segmentation with no disability.

For quality control, we have to extract the eldest child age and gender if there is no disability. If the eldest child has a disability then we move to the next eldest one.

The solution:

In the file attached after I did a slight change to it from the orginal file solved by @MohammedTaleb in this post: