Photo by Jose Aragones on Unsplash

How To Disable a Button in Coda?

Tips to make multiple rules work together

While finishing my archiving logic, more about it here and here, I had to make sure that the HRM employee could only unpack employees active this month or last month. While writing this part, I noticed I had to foresee additional limitations to avoid an unwanted data mix up. Below the logic I work with.

The set up

In this blog some of the learnings I came across while trying to merge several rules inside the disable function of the canvas button I am using.

One disable function is easy to test, it works or it does not. Multiple disable function you can test one by one on the canvas and once you see they work as intended, you start combining them. I would not have written this blog when all would have been okay following this procedure.

This is what I created.Why don’t rules that work on the canvas one by one, not work together?

I did not see it directly, until I wrapped all these functions into a List(), see below. This showed where to look. Argument one and two cannot be false at the same time I noticed due to this outcome. Without this list logic, it would have taken me quite some time to spot it I am afraid. The other ‘true’ is actually okay. It tells me that in case none of the rows in the table DB Archive is selected, the logic to restore fails as well, because there is nothing to restore and when I want to restore multiple months, it fails as well (Count() !=1).

The list function helped me to evaluate each item (formula) one by one.

In a disable function you set the criteria, that once met, disable the button. The last one DB Attendance.Count().Contains(0).Not() disables in case the count of the rows in the table DB Attendance is not zero.

Í had find a solution for the month logic, making it only possible for the user to select one month, not two. On top only this month or previous month. My first idea was to trust the user, but this might go wrong easily. I therefor decided to create a table (a view of a table I already used to deal with dates and months) that only contains in the view this month and previous month.

Select Controls take the values of the table they are related to.

I thus created a filter on a table that is — as said — a view of another table as BenLee explains rather well.

and this filter on the table view results in what you see below:

The control linked to this table looks like this:

The Select Control

We are almost there. Due to this new Select Control I can remove the date related disable functions that excluded each other and the rule that avoided multiple months. My last taks is to take away the List() function and structure the rules again using OR

The new disable function

The result is that we have buttons that behave intelligently and help users to avoid mistakes due to a smarter Select Control. The List function was essential to see where it went wrong and thus to fix the rules.

I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. Besides you find my (for free) contributions to the Coda Community and on Twitter

My name is Christiaan and I support SMB with calculations (budgets and planning) and I prefer using Coda to get the job done.

Not to forget: the Coda Community provides great insights for free once you add a sample doc.

Christiaan writes about: ”How To Disable a Button in Coda?”

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Christiaan Huizer

Christiaan Huizer

I use Coda mainly for planning & calculations of all sorts. Follow me to learn how to Coda with numbers. I blog at least once per week.