Need help creating a button that overrides a table filter with it's own default filter

So here’s the thing: I originally created control filters for my doc, where I am able to sort my table from Device Category and OS version (it’s an doc that checks in/checks out devices based on the device type and OS version, serial, etc).

But when I tried interacting with the controls on a mobile device, it was really not user friendly and a bit buggy, especially when you have several options and need to click one by one. So as a work around, I decided creating buttons that filtered my devices by category would work best: iPhones, iPad, Android Phone, Android Tablet (see screenshot below.)

The iPhone, iPad, Android Phone and Android Tab buttons all share the same formula - just with a different device category value.

When you press each of those buttons, the “Current Category” shows the current button being clicked (highlighted by a Conditional format) and the table below (My Device Table) filters to that button’s criteria.

Here is what the filter formula looks like:

And it works…for those four buttons.

But my dilemna is with the “All” button where I want that button to show all current devices irregardless of their category. I tried adding an or statement in that filter and it just ended up displaying all the devices that were Not Available, Missing, etc. that I didn’t want to show, i.e. the formula in the filter got borked.

I was trying to do something where I added a column to My Device Table called “Reset” and the value to “All” so that someway I can filter that “All” value, which every device listed will have and somehow override the other filter.

Can anyone help me with this?

Here is my test doc to play around with it:

So I solved it and it was simpler than I thought it would be:

The yellow “All” button will spit out its own value in the Current Category text column called “All” (this can be any text actually, just chose that one). Then all I had to do was add an OR condition in the device table filter with Status=“Available” AND Navigation.CurrentCategory=“All” (as long as the filter value matches the one in the Navigation table, you are good - See screenshot below):

Now trying to figure out a way where I can toggle each button to turn on and off the category, which will probably be a little more difficult - but I will add it if I figure out a good solution.


So I figured it out and it looks like this:

So I have 5 filter buttons: All, iPhone, iPad, Android Phone and Android Tablets. I am able to toggle them on and off one at a time or combine the filters by toggling more than 1 together. Added a search icon as a symbol for my ‘on’ state for the button.

Button Code:

Inventory is my main table name where all my device name/categories/data are being pulled from.

Show All is a checkbox column that sets all device items to ‘true’ and displays all of them at once.

For the “All” button, the code is something like this

if(Inventory.[Show All].ContainsOnly(true), ‘:mag_right:’, ‘All’)

Note: Adding the ‘if’ statement to the “Label” code section allows you to toggle from one state to the next.

if(Inventory.Category.Contains(“iOS - iPads”,“iOS - iPhones”,“Android Phones”,“Android Tablets”) AND Inventory.[Show All].contains(false), ModifyRows(Inventory, Inventory.[Show All],true), ModifyRows(Inventory, Inventory.[Show All], false))

Disable If:
[No code]

For the other 4 filter buttons (iPhone, iPad, Android Phone, Android Tablet), the code is basically the same, minus the different text value that represent each device category.

Confirm Match is a checkbox column that marks ‘true’ if the device Category matches that of the button filter. Marks ‘false’ if it doesn’t match.

If(Inventory.Filter(Category=“iOS - iPhones” and [Confirm Match]=true).First(), ‘:mag_right:iP.’, ‘iPhone’)

If(Inventory.Filter(Category=“iOS - iPhones” and [Confirm Match]=true).First(), ModifyRows(Inventory.Filter(Category=“iOS - iPhones”), Inventory.[Confirm Match], false), ModifyRows(Inventory.Filter(Category=“iOS - iPhones”), Inventory.[Confirm Match], true))

Disable If:
Inventory.[Show All].ContainsOnly(true)

Last step – the table filter:

Need to add code to the filter but note it’s a different table from my Inventory table — which is my parent table. The table below my buttons is a child table (a view from Inventory) called “Search By Category”, so the filter code goes there.

Something like this:

thisRow.Status=“Available” AND thisRow.Category=“iOS - iPhones” AND thisRow.[Confirm Match]=true OR thisRow.Status=“Available” AND thisRow.Category=“iOS - iPads” AND thisRow.[Confirm Match]=true OR thisRow.Status=“Available” AND thisRow.Category=“Android Phones” AND thisRow.[Confirm Match]=true OR thisRow.Status=“Available” AND thisRow.Category=“Android Tablets” AND thisRow.[Confirm Match]=true OR thisRow.Status=“Available” AND thisRow.[Show All]=true

And done! Hope this helps someone who want to ditch the controls and go with something more mobile friendly. :slightly_smiling_face:

Much thanks to Coda Support for helping me with this solution, couldn’t have done it without you!!!


@Nickesha_Lindsay, thank you for the great writeup here!

Very much appreciated! :+1:

This documentation is incredible and so thoughtful! Thank you for empowering others to make awesome buttons!

1 Like

This is great @Nickesha_Lindsay, thanks for sharing. Will be points folks who ping support to this write of yours.

1 Like

Really great work on this Nickesha! Definitely something I’ll be pointing other folks to as an example. :slight_smile:

1 Like

This is so awesome, thank you for sharing it! :star_struck: