Thank you so much…this is perfect!
+1 on “Select All” for multiselect lists
+1 on simplifying it to “Everything” vs the list
I think it is as simple as:
Select All
LookupControl.SetControlValue(MyTable)
Since my multiselect is based on a column doing a lookup from another table, I was able to use SetControlValue(control,lookuptable.toText()) but the problem is that it isn’t obvious on looking that all are included w/o clicking on the control vs. if it shows “All” same with the full 1/1/1-12/31/3999 datepicker vs. “Everything” for other users
Yeah that part I 100% agree with. Should infer the summary
Hi Coda Team,
I just tried to add this feature to my doc, and after some trial I got it, except the workaround with the select all.
Could someone help me create the select all/reset button for a none date picker? I made this little sample doc. Select Button
Once this works, I will try to make each project button a toggle which I think would improve usability in my example.
Thanks everyone for the help and coda team for all the great features, you rock!
how do I set a control to a blank value. I want to clear the selection to nothing
MyControl.SetControlValue('')
''
is the value for blank
Confusingly, SetControlValue can’t add Blank to a Lookup, only to a MultiSelectList
I fixed your doc so it works, but this caveat will still apply:
It doesn’t say “All”
Formula was:
SetControlValue([Select Projects Gobal], Projects.ListCombine(''))
If you wanted all the Projects, but without adding blanks:
SetControlValue([Select Projects Gobal], Projects)
Please Please Please, consider to add the blank and the select all values to the Set Control!
It would be incredibly useful use a button to reset all interactive filters!!
I end up creating tables to do more granular and interactive filtering just to use buttons to reset to all or to the first value.
This is awesome and something I was relieved to find was possible. Unfortunately, I’m quite new to this, so can’t implement what you’ve done. Could you post the screenshot of what you actually set-up via the Set Control Value action.
Specifically when I try to implement with the “Set Control Value” action, it only allows me to set up one action. It looks like yours triggers two actions, which is what I’d like to do as well. Does that mean you used a formula? If so, could you post that formula?
Hi John! I’m afraid it’s been quite some time since I set this up and am not even sure in which doc I did so anymore So, apologies in advance if I’m not fully remembering the scenario correctly, but I spun up another doc to walk thru this
Also, this functionality has improved in the past year or so, so hopefully this is even better!
Let’s say I have a table of foods, and each food can be assigned a Type
like protein, vegetable, or fruit.
The first thing I’ll do is make sure my Type
column is a select list, so that the only values in it can be the types I indicate above.
After clicking “New,” I’ll let the Coda magic pre-fill the selectable items based on what I have in the table already. (I could also type in new values, or use a table, but for simple use cases, I like this way.)
Why do I want a select list? Partly for data validation, and partly to have the type of control I want to filter my data.
So, next I’ll create an interactive filter on my Type
column to allow me to filter based on selectable types of food:
By default, this will give me a select list control above my table. You can always click and drag it to a new location if desired, but above the table tends to be a convenient spot for it!
Here’s an example of me using the new control to filter my results only to Proteins:
Now I want to create a “Reset” button. To do so, I’ll type /set control value
in the location on the canvas where I want to put my button, and choose that button type. Then, I’ll fill in my button settings:
- A memorable name & label
- Confirm the action is “Set control value”
- Select the name of the control (interactive filter) I configured above – in this case it’s “Select Foodstuffs Type”
- Set my value as
listcombine(Foodstuffs.Type.Unique(),"")
So what the hanky is that formula?
Basically the syntax is: ListCombine([Name of the Table].[Column with the possible values].Unique(), " ")
What I’m telling Coda with that formula is:
- Look at this table
- Select a combination that includes (1.) the list of all of the unique values from the “Type” column, and (2.) blanks (aka " ")
^ Note, you can get away without the unique()
part of the formula, but I find it’s a good habit to build as your tables get bigger and more powerful to optimize for performance by telling Coda: “Please only worry about the unique possible values, and not the values in each and every row of the table.”
Et voilá! Because this is a formula in a “Set Control Value” button type, it will set the control (aka, interactive filter) to all of the possible individually-selectable values–including blanks.
@Andrew_Stinger Wow…how I’ve needed this!! Thank you!
Hi,
Thanks for the fantastic tutorial on how to filter table using button. May i ask , is it possible to do the same without via the interactive filter? That is, use button to directly control the filtering of the table
Hi @shushimi ,
The general answer to your question is “yes,” but there are a host of ways to do so based on your actual goals/criteria. The value of using the interactive filter method is that it creates a control that can easily be modified to update how the table is filtered.
If you’d like to explore options to filter via a button, you could consider using formulas in a new button. The “set control value” and “run actions” formulas are probably ones you’d want to gain familiarity with to do so: Coda | Formula library
Another tip is to play around with the interactive filter options, then go to your table Options > Filters and click the “f” icon to see the formula that the interactive filter is actually running. Then you can use that logic in a number of places, including a button.
Thanks for the hint!
I am in the midst of trying your suggestion. I never realize button can set formula, cos i look at the button’s actions dropdown list, and never saw an option for setting formula. Turn out i have to click a “f” icon in order to set formula.
Now the only remaining question is what formula to use. As you suggest, I try refer to the table to get the formula that the interactive filter is actually running , but realize that formula can’t be used. Cos the formula refers to the interactive filter control’s value, which i trying to avoid. I try modify the formula so that upon click the new button, it will control the table’s filter directly, but can’t get it to work, as i total newbie in coda formula. Anyway, will continue to explore on this. Thanks
May i know why the action menu of a new button i create, do not have “display filter row” ? Or is this something that is missing, and hopefully Coda will add it in future
Hello @shushimi ,
Filters are set in a table, not in a button. That said, you can use checkboxes to control your filter settings (by using a switchif() in your filter). The checkboxes can be hidden and they can be set with a button, but I find it easier to display the checkboxes as switches and use them to control my filter.
If you share a dummy doc with a table and a description of what you would like the switches of button to filter, we can show you in your doc how it can be done.
I think there is no need for an extra button action to accomplish what you want. It would not be all that easy, because the button would ‘need to know’ which table to act upon and what to do with existing table filters. That would be rather complex.
Hello @joost_mineur
Thanks for the suggestion.
My ultimate goal is to : Provide a few buttons. When button A is in “pressed” state, the table will be filtered based on specific value. When button A is “unpressed”, the table will be unfiltered. Same for rest of other buttons.
I hope to achieve this , without involving intermediate widget (such as checkbox or dropdown list)
As part of the process of learning Coda, I try to learn how to achieve whatever i have in mind, rather than avoid it. But once i manage to achieve it, if it is really that complex, I would switch to other way of achieving the same goal.
I personally feel that Coda should provide button’s action or formula to filter the display of table’s rows, where we could provide the table name, column name, and the value to filter. Look like currently this is not possible, unless i provide an intermediate widget (such as checkbox or dropdown list).
Btw, I am currently already able to use button to set an interactive filter(dropdown list) to a value which in turn control the table filtering. Just that I thought Coda allows me to do the same without involving this interactive filter.
If there is a way (even if complex) to set the filter in the table to filter the table based on the “pressed” state of the button, hope can share with me how this can be done via
Test for a dummy doc.