Hello,
Iโm working on a tourism app and I have the following tables:
Logic behind it: A Travel Agent will book a service (buffet, for example) at a restaurant in a specific destination.
The issue:
Iโm trying to create several depending dropdown list
Restaurants, when a destination is selected (This one works).
Services, when a restaurant is selected (This one is the problem since it depends on the previous one).
Progress
This is the data structure:
Based on this article (https://help.appsheet.com/en/articles/961554-dependent-dropdown) my formulas at Data Validity are as follow:
For restaurant dropdown (this works fine)
IN( [_THIS], SELECT(Restaurant[restName], [_THISROW].[destinoID] = [restDestino]))
For restaurant services dropdown
IN( [_THIS], SELECT(RestaServ[restServServicio], [_THIS].[restID] = [restID]))
However, when I open the form the list of restaurant services is already populated with all the options even though the restaurant hasnโt been selected yet.
Iโm guessing that this might be because of [_THIS].[restID] is blank when the form opens?
Thanks for any assistance!
Solved! Go to Solution.
Try this for restID:
FILTER("Restaurant", [_THISROW].[destinoID] = [restDestino])
And this for restServID:
FILTER("RestaServ", [_THISROW].[restID] = [restID]))
In a Valid If expression, the IN() wrapper of IN([_THIS], ...)
is unneeded (but also okay to use) if ...
is a list. Both SELECT() (which you used) and FILTER() (which I use here) produce lists.
Iโve suggested FILTER() because it always produces a list of Ref values. Many people get confused with how to gather Ref values using SELECT(), so FILTER() removes the chance to make a mistake.
Automatic dependent dropdowns only work for columns with Valid If expressions that use only a table-column reference. You appear to be using more sophisticated expressions, which will override the automatic dependent dropdown feature.
This your non-working expression:
IN( [_THIS], SELECT(RestaServ[restServServicio], [_THIS].[restID] = [restID]))
Try this instead:
IN( [_THIS], SELECT(RestaServ[restServServicio], [_THISROW].[restID] = [restID]))
Hi Steve!
I have applied this change and the result is the opposite that it was happening hehe.
Now when the form loads the restaurant services appear in blank (which is great!) but even if a Restaurant is selected the previous dropdown the list of services wonโt upload.
Try this for restID:
FILTER("Restaurant", [_THISROW].[destinoID] = [restDestino])
And this for restServID:
FILTER("RestaServ", [_THISROW].[restID] = [restID]))
In a Valid If expression, the IN() wrapper of IN([_THIS], ...)
is unneeded (but also okay to use) if ...
is a list. Both SELECT() (which you used) and FILTER() (which I use here) produce lists.
Iโve suggested FILTER() because it always produces a list of Ref values. Many people get confused with how to gather Ref values using SELECT(), so FILTER() removes the chance to make a mistake.
It works great:) Thanks!
It is great to have this work around.
User | Count |
---|---|
32 | |
11 | |
3 | |
3 | |
2 |