'Recursion' in formulas for self-related types

Where a relationship exists between entities of the same type, it is possible in Coda to refer to the field of a related entity in the formula for that field. This allows for some interesting possibilities:
recursion
Can we have that in Fibery too please? :pray:

Wow, that’s seems to be an implementation side-effect, that we don’t allow formula to relate to itself. Like if you have formula field with name Test, you cannot reference this Test field in this formula. We restrict it to avoid infinite loops.

But in case you’ve described it is not the problem, as you refer to the formula field of child entity. So it seems like simply a bug from our side. I’ll check this case more carefully and if everything is ok, will enable using those formula field inside self-referenced relations.

1 Like

I did actually solve my problem using a pair of fields (where they reference each other) bit it would be nice to avoid this.
FWIW there is still a possibility of infinite recursion if the relationships are not carefully managed. E.g. If the formula is Test=Child.Test + “string” and A is parent to B, B is parent to C and C is parent to A.

I have noticed that I can crash Coda with such usage :-/

Similar problem exists in Fibery formulas, but please don’t tell anyone :sweat_smile:.
Soon we will add a loop prevention mechanics to formulas, so if some calculation causes recalculation of the same formula several times, we will not recalculate it, reporting a loop detection. We have such mechanics in Automation Rules, need to spread it to formulas as well.

By the way I’ve checked this and it seems it is already possible to do similar stuff in Fibery.
Here is formula setup:

Here is data example with entity that relates to itself:

Everything is similar to Coda example, except new line. Do not remember at the moment if it is possible in Fibery formulas. The only thing is that you first need to create formula field with any formula entered, and only during next edit this formula field will be available for [Child Types] field in the editor.

Thanks for looking into it. I guess I just assumed that since the auto-complete didn’t offer the field name, then it wasn’t possible. I supposed I could have tried it first!
FYI, the demo images you showed don’t quite get what I need, since I actually want to show all recursive branches in full. So the Combined names for the row A should show:
AB
ACD

But I think I can figure out how to do this anyway.