I’d like to display a list of car dealerships, filtered by both city and car brand.
However, instead of having one list of all the dealerships with two filters on the page, I’d like the user experience to be:
Select your city from a list
Select a branch from a list
See all dealerships for that brand in your city
So I have 3 tables. Both “City” and “Brand” only have a “Name” column.
Then the “Dealership” table has a “Name”, “City” and “Brand”.
What I have so far:
Screen with a collection of cities
City detail screen shows a collection of all brands (not filtered)
Brand detail screen shows a collection dealerships filtered by the brand
I’d like to be able to filter the 3rd screen by the city that was initially chosen, but I can’t seem to find a way to pass this value from screen 1 to screen 3.
I’ve seen a bunch of posts around about “Inline lists” that you can use on the detail page to filter by a relation. But I can’t seem to find them anywhere. My dealership collection is a regular list using a screen value to filter by brand.
I’ve also seen people creating multi filters by making a filter set a column on the user table. But I can’t figure out how to do this when you click an item in a collection.
Is there a way to do this? Or is perhaps my data shaped incorrectly to allow this?
That’s probably the simplest way to do what you want.
You just modify the Item Click Action on the Cities collection so that it first sets the selected City Name in a column in the User Profile Row, and then does a Show Detail Screen → This Item. Then when you get to the Dealership screen, use that value as a filter.
To modify the Item Click action, you need to enable advanced actions, and then create a custom action for Item Click.
Note that the above will only work if you have User Profiles configured, and will only work for Signed In Users. If you have Users that won’t be signed in (ie. Visitors), then you’ll need a different solution.
If you had a mix of Visitors and Signed In Users, then I would recommend using a single row Helper table.
Create a table and add a single row
Add a User Specific Text column
Create a screen with a custom layout that uses this table as the source
Add a Collection and set the source as the Cities table
Modify the default Item Click action so that it first sets the City name in the User Specific column
In the Dealership table, add a Single Value column that targets the User Specific column in the Helper table. That will apply the selected City to all rows in the Dealership table.
How would you go about showing some sort of empty state if there are no items in the collection which match both the filters? Ideally I’d like to show a message that contains the selected items, eg. “Sorry, there are no Ford dealerships in Brisbane”. But a generic message would be fine too, eg. “Sorry, there are no dealerships here”.
What you can probably do here is change that relation column to a query column, and set two filters on it:
Brand is This Row → Brand
City is User Profile → Selected City
Use that query as the source of your Collection (without any filter), then add another component with the message you want to show, and set the visibility on that so that its only shown when the Query is empty.