Some formulas using relation columns now broken?

A few of my column formulas have suddenly broken. I haven’t quite figured out what the problem is, but it could be this… I’ll try to explain the best I can:

  • Let’s say I have an Orders table with a relation column Company linked to table Companies.
  • In the Companies table I have the column Contacts linked to a Contacts table.
  • In the Orders table I have created a Linked Contacts column, which uses a formula: [Company].[Contacts]

Now this works fine, I get a list of contacts related to the order. The contacts show up normally in the Orders table column as chips that I can hover over and see details from the Contacts row.

If I now add a Contact emails column in Orders with a formula that tries to access the properties of the contacts in the Linked Contacts column, I get into problems.

My old formulas that used to work now give errors, usually “unexpected dot operator” error.
If I try to create a new formula, I can no more access any of the properties of the contacts.

I can go around this by creating a formula something like this:
[Contacts].Filter(CurrentValue.In([thisRow.Linked Contacts]). But it seems quite silly to have to do a search on the Contacts table to get the rows that I already have in the Linked Contacts column. :slight_smile:

Has anyone else encountered this? Is this a bug or a feature?

Hi Niko,

It is difficult to see without having access to the document or a copy of it, but have you tried to add the related columns via the menu options:

Hi Piet, I set up my example in a new doc… and it works as expected. So I can not reproduce the original problem here. :man_shrugging:

I cannot share the production doc where the problem is happening, but I simplified the problematic formula and took screenshots.

The Subscriptions column I reference here is a relation column that allows multiple values. I try to get the last referenced value. For reasons unknown, Coda outputs a text value rather than a row ref and the named currentValue Last Subscription becomes text. Understandably there is no Start date property for the text value, so I get the “Unexpected dot operator” error.

With my “fix” I get different problem. Here I filter the T Subscriptions table to get the row that is referenced last on this row’s Subscription column. This time Coda thinks the Filter(...) function and consequently the Last Subscription value outputs a table!

While working on these screenshots, I tried to edit the Subscriptions column and just re-selected the same table for the relation. This caused a small change:

The icon for the column reference changed from text to row… :thinking: Unfortunately that did not fix the formula. The CurrentValue still outputs either a text type or a table type.

There’s a good chance I’m overlooking something and have caused this problem myself, but I just can’t figure out what’s wrong or how to go forward with troubleshooting.

I found a solution! Adding ListCombine() before the Last() function fixes the CurrentValue type. So this works:

[Subscriptions].ListCombine().Last()
  .WithName([Last Subscription],
    [Last Subscription].[Start date].Day()
  )

I don’t exactly understand why ListCombine is needed here, but I’m happy the errors are gone. As often is the case, problems start to solve themselves when you spend the time and effort to explain them. :smiley:

1 Like

I have been experiencing something similar!!

In my scenario I have believed it was related to Coda automatically changing the type of a column (see this post) because what is happening is a relation column in a ‘helper’ table (therefore there is only ever one row in the table) is being changed to a text column, which is what causes the “unexpected dot operator” error. Manually changing the column back to a relation fixes it.

In more detail -

I have a customers table, and a “send email” helper table with a “recipient” column that is a relation to the customers table.

Thus I can click a “send email” button in the customers table and a row is added to the helper table, the recipient column in the helper table is set to the customer (ie. "thisRow), and the new row is opened. But for some reason, which I have presumed to be related to the column “auto-typing” that coda does (:exploding_head:) the recipient column in the helper table gets automatically changed to a text column, meaning there is no reference back to the customer and so the send email button which has a reference to “Recipient.Email Address” shows the “unexpected dot operator” error.

Ironically, I got around the problem by setting the value of the recipient column to “thisRow.CustomerName.ToText()” which causes the column to match the text to a customer, and doesn’t auto-type the column to Text!! :man_shrugging::man_shrugging:

Hopefully the above helps you in some way.

That is quite hilarious. :smile: I’ve gotten used to trying ListCombine() whenever I have this kind of typing issues, but I have to add ToText() to my toolbox as well. Thanks for the tip!