Disable one element of list in a second, nested, roster

Hello !

I’m quite desperate on this one:

I have a roster (say “ROSTER1”) that goes through a list (say “LIST”) of people in a given household to ask some typical questions like name, age etc.
Within ROSTER1, I have a nested ROSTER2. The purpose of ROSTER2 is to know what are the relationships between members of the household. Thus, the source of ROSTER2 is LIST, same as ROSTER1.


(Sorry, this is all in French, but maybe can still help to understand the structure. ROSTER1 is Roster_B_HABITANTS and the nested ROSTER2 is SUB_Roster_B_HABITANTS).

Up to that point, this works like a charm. Let’s say we have Peter, Jack, and Mary in the household (i.e in LIST). In ROSTER2, will appear three questions, for each member :

For Peter :

  1. Who is Peter in relation to Peter ?
  2. Who is Peter in relation to Jack ?
  3. Who is Peter in relation to Mary ?

Then for Jack :

  1. Who is Jack in relation to Jack ?
  2. Who is Jack in relation to Peter ?
  3. Who is Jack in relation to Mary ?

And similarly for Mary.

Here, I would like to avoid the first question to show up in each case (e.g Who is Peter in relation to Peter ?).

A secondary objective would be to implement validation condition that would prevent weird relationships. For example if Peter has declared being “son” in relation to Jack, Jack cannot declare being “Grand-Father” in relation to Peter, but just “Father”. This is optional to me, but would be very neat yet.

I realise this may have been answered partially or entirely in other posts, but after trying many different things I couldn’t figure it out.

Many thanks for your work on this forum, and for helping me on this,
Sincerely,
Noé B.

Insert a Long Integer variable current_member with expression: @rowcode just before the sub_roster to remember which member you are interviewing.
In the sub_roster add an enabling condition: @rowcode != current_member.

For avoiding weird relationships specify validation conditions in the relationship question B13.
I’ll try to create one example later.

Klaus

@klaus beat me to the punch.

Here’s a questionnaire that does what Klaus described.

Here’s a validation condition for a ‘weird relationship’:
Someone says “I am the child of X”, but X did not say (s)he was his parent (but his brother, uncle, etc.).

Add a validation condition to B13:

(self == 8) ? (Roster_B_HABITANTS[@rowcode].SUB_Roster_B_HABITANTS[(int) current_member].B13 == 9)
|| (Roster_B_HABITANTS[@rowcode].SUB_Roster_B_HABITANTS[(int) current_member].B13 == null) : true

with a message like: “But %rostertitle% said he is not your parent!”

Note: the second part of the condition which checks for null is there to avoid the error message when the referenced person has not yet responded (its answer value is still null).
If you plan to add such validations I can show you how to do this null handling in a shorter way.

Klaus

Wow !!

Thank you both, and particularly Klaus!
I could not have designed such a nice expression myself. I think SuSo could gain in “transparency”, as it is quite hard for a beginner to understand how to refer to such and such element, particularly within rosters. Is there somewhere a schematic illustration of roster structures ?
For example, a figure that would show what is “Roster_B_HABITANTS[@rowcode]”, and how to “call” it in an enabling condition or a filter maybe.

Anyway, both of your answers have made my day!

@klaus , I’m very interested in how to make the “null handling” shorter yes, thanks :slight_smile:

Have a great weekend,
Noé

Okay. Just replace the validation condition by this one:

( self == 8) ? ((Roster_B_HABITANTS[@rowcode].SUB_Roster_B_HABITANTS[(int) current_member].B13 ?? 9) == 9) : true

where the value after ?? is the same as the one it is compared to, after the ==.

The

( expression ?? value)

means: if the expression is null, substitute value for it.
So if the referenced person has not yet responded (its answer value is still null),
then the validation condition will be true, i.e. no error message shown.