Dependent dropdown using a Many To Many recursive relationship

Hello all! 

I have a structure as below: 

Users table
another table to manage the N to N relation from Users to Users -> this relationship is "Team Leader". 
A user can be Team Leader of several other users, and a user can have 1 or more Team Leader. 

Then, inside a table "Report" I have the user that work on this report + the team leader. 
Here a simplified presenation:

DroidTeo_0-1665497865691.png


I would like to show inside the drop-down at report level, only the team leader linked to the user assigned to the report. 
So I've tried (inside the valid if field) this exepression (translated by AppSheet using the natural language):

 

(The value of column 'Inspector') is one of the values in the list (The list of values of column 'Engineer'
....from rows of table 'TeamLeader Engineers'
....where this condition is true: ((The value of column 'Team Leader') is equal to (The value of column 'TechnicalManager')))

 

using the expression notation:

 

IN([Inspector], SELECT(TeamLeader Engineers[Engineer], [Team Leader] = [_THIS]))

 

where Inspector -> the Ref field inside the Report table towards the users table
TeamLeader Engineers  -> the N-N table 
TeamLeader Engineers [Engineers] -> is the ref towards the users table (inspector)
[_THIS] -> the selected Team leader

But it doesn't work.. Why? 
How can I retrieved the team leader linked to the selected inspector? 

PS inside the Users table I have 2 lists: 
1) Related TeamLeaderInspector By Inspector
and 
2) Related TeamLeaderInspector By Team Leader

0 3 105
3 REPLIES 3
Top Labels in this Space