Cross-repeat consistency check

Hi everyone :waving_hand:

Hope you’are all good !

Thanks again for all the support I receive last month ! This is terrific for us and our research project !

I’m back with a new puzzle to solve :exploding_head:

Here is what my questionnaire looks like :

Begin repeat 1 : recording all places of activity
Q1 => enter a place of activity (text)
Q2 => placement-map of the place (geopoint)
Q3 => what kind of place is it (Work, University, School, other) ? (select_one)
End repeat 1

Begin repeat 2 : chain of displacement (or movement chain)
Q4 => what are the steps of this chain ? (map appearance, choosing geopoints from Q2)
End repeat 2

Q6 => control of consistency (note message)

My question is about Q6 : I would like to control the consistency between the first repeat and Q4 (places selected in the second repeat).
Something like : if in Q3, "work" has been selected once, at least one geopoint associated to "work" has to be selected in Q4.

The goal here is to make sure the respondent hasn't forgotten to include any locations in the second repeat. Do you think it’s possible ?

Here is the logic from a first attempt with AI support :
Inside repeat 1 => calculate | is_work | if(${q3} = 'work', 1, 0)
Outside repeat 1 => calculate | work_count | sum(${is_work})
Inside repeat 2 => calculate | is_work_selected | if(${places}[./q2 = ${q4}][position()=1]/q3 = 'work', 1, 0)

And eventually, for Q6 => if(${work_count} = ${work_in_chain_count},
'Consistent ✓', 'Not consistent')

The problem with this is the ‘inside repeat 2’ calculation expression, it doesn’t work at all ! But maybe it’s not so far from achieving something ? I don’t know !

Here is the file

Essai_control_consistency.xlsx (14.5 KB)

Have you tried using indexed-repeat function?

Hi Florian,

You want all the places created in first repeats to be selected one time and only one only in the second one ?
Maybe you should hide from the second repeat every place already selected.
To do that you'll have to join the selected choices with a space ' ' and add a choice_filter condition based on that emulated select_multiple string.
I have never tried it with "volatile" choices list but it works really fine with classical ones.
I'll check for an example form.

Failing to make it work and reading carefully Hélène's answer, I understand it is not possible to reference columns in the choice filter of the second repeat :

If all the places must be selected one and only one time, a rank question to order the travel steps should work ?
Essai_control_consistency.xlsx (10,6 Ko)