I have two tables that collect two different kinds of events. Each has a date column which I would like to aggregate in one view, perhaps a calendar. With SQL I would just use UNION ALL. What is the corollary in Coda?
There’s a suggestion here:
It’s essentially to have a single table for all events you wish to display in the calendar. This master table will have an additional column used to identify the event type of each row which can then be used to generate sub-table views.
I.e. you have as many table views as you like, each containing events specific to that view (as identified by the type column) and then create the calendar from the master table.
Here’s an example:
- A project table holds two projects the team is working on
- A “hidden” project events table holds all the events
- Two views are created - one for each project. The project column itself is hidden.
- Two buttons are created to add new events for each project. Each button is configured to enter the right project name into the hidden project column.
It looks like two separate tables with one calendar but it’s really just one table with filtering.
Thanks Nick. That will work.
It’s worth pointing out a subtlety here. Notice in the filter configuration the “APPLY TO NEW ROWS” switch is enabled? This has an effect similar to “VALUE FOR NEW ROWS” in a column definition - if you add a new row directly in the view (not using one of the two buttons) Coda will automatically fill the hidden Project column with the right project name depending on which view you added the row to. So, in the view that’s filtered to just show “Project 1”, every time you add a row the Project column is handily configured with “Project 1”. Same for the Project 2 view.
What’s interesting is you can’t actually configure that behaviour in the “VALUE FOR NEW ROWS” element of the column definition because the column belongs to the underlying base table and is therefore the same for all views.
/edit - maybe this was obvious to everyone but me!
Thanks. That actually answers a question I had rumbling around while I wasn’t able to go look for myself.