I can't find a valid formula for the "Valid_if" of a dropdown list

I have this database structure:

Captura de pantalla 2023-06-05 123936.png

 

In the Invitado_form (guest) I need to filter in the dropdown MESA to see only tables in the SPACES assigned to the guest's EVENT.

I tried:

SELECT([MESA].[IDMesa], IN( [MESA].[Espacio], SELECT(Evento_Espacios[Espacio], Evento_Espacios[Evento]=[_THISROW].[evento])))

Cannot compare List with Ref in (Evento_Espacios[Evento] = [_THISROW].[evento])

---------------------  and this, with dereference expression:

SELECT([MESA].[IDMesa], IN( [MESA].[Espacio], [evento][Related evento_espacios]))

Column 'evento' is used in a SELECT or list dereference expression and should be a List/EnumList of Refs

-----------------------

Can someone help me please?

 

Solved Solved
0 4 143
1 ACCEPTED SOLUTION

FILTER( Mesas , IN( [Espacio] , SELECT( Event_Espacios[espacio] , [evento] = [_THISROW] ) )

View solution in original post

4 REPLIES 4

Add a new VC to Eventos table, to pull a list of Espacios records, with : [Related evento_espacios][espacio]

Then for the valid_if, use:
SELECT( Espacios[Related Mesas] , IN( [idEspacio] , [_THISROW].[Evento].[new VC] ) )

EDIT: sorry, forgot to flatten the List-of-lists. Update to above expression:
SPLIT( TEXT( SELECT( Espacios[Related Mesas] , IN( [idEspacio] , [_THISROW].[Evento].[new VC] ) ) ) , ' , ' )

 

In standard SQL would be something like this:

SELECT IdMesa FROM Mesas WHERE Espacio IN (SELECT Espacio FROM Evento_Espacios WHERE Evento= [_THISROW].Evento )

But i can't figure out how to translate that into an appsheet expression!!!!  ๐Ÿ˜ž

 

FILTER( Mesas , IN( [Espacio] , SELECT( Event_Espacios[espacio] , [evento] = [_THISROW] ) )

So  simply and clean!  Thank you Marc!  

Just a small detail,  I had to add [evento] to [_THISROW]:

FILTER( Mesas , IN( [Espacio] , SELECT( Evento_Espacios[espacio] , [evento] = [_THISROW].[evento] ) ))

Top Labels in this Space