Using Checkbox to Apply Filters

I have a table with a “Status” selection box column; this has predefined values such as “Draft”, “Published” and “Archived”.

I want to be able to allow users to filter the table based on “Status”, but so that any combination can be selected. Currently, we’re achieving this using a Multiselect Control, but I’ve had requests to change this to checkboxes; there’s a few reasons why this fits better, but the big one is that instead of it saying “Draft + 2” (for example), it gives immediate visibility on which “Status” options are being filtered for right now.

However, I currently cannot get this to work. I can do it for a single value, but not multiple checkboxes being selected. I’ve tried using formula elsewhere that produces a string of “Status = ‘Draft’ AND Status = ‘Archived’” and referenced that, but it doesn’t work.

Is there anyway to set the value of a multiselect dynamically? If so, I could definitely patch something together. If not, any suggestions on how this might work?

FYI the checkboxes are not contained within the table.

@Murray_Adcock

I was just refactoring mine. This probably isn’t what you want, but I place on the canvas beneath the multiselect control a formula outputting the multiselect value to a bulleted list, so that I can quickly see what is selected:

I can’t wait until these filter controls are built into the table interface. :innocent:

1 Like

Nevermind, I just solved it :laughing: But thanks @Ander, interesting method :slight_smile:

For anyone else trying to do this the trick is the .Contains() function.

I set up my checkboxes with names like “filterArchived”, “filterDraft”, “filterSubmitted” etc.

I then filtered my table with the following formula:

[Status].Contains(If([filterArchived],"Archived",""),If([filterDraft],"Draft",""),If([filterSubmitted],"Submitted",""))

What this does is check each checkbox by name within the .If() statements, and if it returns true (i.e. is checked) then adds the related Status value to the array being queried within .Contains(), if it returns false it just leaves the addition blank.

If they’re all unchecked, you get a string filtering on blank, so it displays any rows without a Status, but I can live with that (as there shouldn’t be any really) :slight_smile:

1 Like

Was working on and had the same solution so sharing the doc here in case anyone in the future wants to copy and play with it.

2 Likes

@Murray_Adcock

That’s funny, I was just solving for this (couldn’t live with it in my case). I appended a second OR statement to my filter for the case when all the checkboxes are unchecked. It works, but adds significant length to the filter formula.

1 Like