It’s probably not a practical solution, but I tried to create a button that can solve my initial problem/question. And succeeded! As I said, it’s probably a stupid way to do things in Coda, but I did it as a learning exercise. Posting here the code in case someone will find it interesting.
This button will populate [Tags table - Projects and Tasks - Split]
table with of all projects and tasks that have tags, pulling them from Projects
and Tasks
tables.
[Tags table - Projects and Tasks - Split]
table has columns Tag
/ Project or Task
/ Type
.
The button puts every combination of Task or Project with unique Tag on separate rows (for example, if Task 1 has two Tags, in the final table there will be two rows with Task 1 for each Tag it has).
Button formula is using intermediate table [Tags table - Projects and Tasks]
to copy all the Tasks and Projects with Tags first, then splits it to the final table.
Button formula:
RunActions(
[Tags table - Projects and Tasks - Split].DeleteRows(),
RunActions(
Projects.Filter(Tags.IsNotBlank()).FormulaMap(
AddRow(
[Tags table - Projects and Tasks],
[Tags table - Projects and Tasks].Tag,CurrentValue.Tags,
[Tags table - Projects and Tasks].[Project or Task], CurrentValue,
[Tags table - Projects and Tasks].Type, "Project")),
Tasks.Filter(Tags.IsNotBlank()).FormulaMap(
AddRow([Tags table - Projects and Tasks],
[Tags table - Projects and Tasks].Tag, CurrentValue.Tags,
[Tags table - Projects and Tasks].[Project or Task], CurrentValue,
[Tags table - Projects and Tasks].Type, "Task"))
),
Sequence(1, [Tags table - Projects and Tasks].[Number of Tags].Max()).FormulaMap(
RunActions(
[Tags table - Projects and Tasks].FormulaMap(RunActions(
AddRow([Tags table - Projects and Tasks - Split],
[Tags table - Projects and Tasks - Split].Tag,CurrentValue.Tag.Nth(1),
[Tags table - Projects and Tasks - Split].[Project or Task], CurrentValue.[Project or Task].Nth(1),
[Tags table - Projects and Tasks - Split].Type, CurrentValue.Type),
ModifyRows(CurrentValue, Tag, Tag.Slice(2, CurrentValue.Tag.Count())),
DeleteRows([Tags table - Projects and Tasks].Filter(Tag.isBlank()))
))
))
)