Filter a table by Billing City (with ability to select multiple cities)

  • 1
  • Question
  • Updated 2 years ago
I am using the Account object for properties (we're a real estate brokerage) and I would like to be able to filter Accounts/Properties by one or more cities. We use Billing Address for the physical address of the property, thus I would want to filter by BillingAddress. I can use the Search Bar to find individual Cities as a workaround but I need to be able to select up to (or more than) 100 cities. Is this possible? Thanks!
Photo of Matt Hartman

Matt Hartman

  • 70 Points

Posted 2 years ago

  • 1
Photo of Matt Brown

Matt Brown, Employee

  • 798 Points 500 badge 2x thumb
Hi Matt, 

There are a few ways you could tackle this, but they will all be "workarounds". What you're trying to do is set up a multi-select picklist filter with a manual source - a model aggregating your accounts by city, giving you a list of values which you can use for a filter. This isn't currently supported by Skuid, since multi-select picklist filters are only available as auto-filters on a table. So there are two workarounds that immediately come to mind. The first step for both is the same though:

1. Set up an aggregate model on the account object.
2. For the aggregation, select the Account Id field, and COUNT as the function. 
3. For the grouping, select Billing City. 

This model can now be used in other parts of the page. The first workaround is to set up a manual source filter, and pull values from your aggregate model, and after the filter is set up, to go into the page XML and change type="select" to type="multiselect". Honestly, this is the simplest solution, but the drawback is that you won't be able to make any declarative changes to the filter after you change the type (you'll have to make changes in the XML). 

The other solution would be to "create a filter from scratch" using a number of other Skuid components. I've done this before with customers where they'll click a button that opens a popup with a list of cities (or something else), that they can select from and add to another model which your original model pulls from to filter by. I would call this the 'shopping cart' model, where the user opens a popup that contains a filter console with options to choose from. 

The last thing I can think of would be to add a custom object (or custom setting) to your org that has all possible cities in it, and then create a custom lookup field on your Account object that looks up to the City object. Then you could create a multi-select picklist auto-filter on that field. 

Hope that helps!

Matt