grist-core icon indicating copy to clipboard operation
grist-core copied to clipboard

Enhancement: many-to-many relationship

Open emanuelegissi opened this issue 1 year ago • 2 comments

(first of all, thank you very much for your work)

I suggest an improvement on how a many-to-many relationship is shown in the Grist UI.

In the following example: https://docs.getgrist.com/qn81cefETPAc/Library you have a book-author many-to-many relationship: a book can be written by several authors, an author has written several books.

In the Books page you can add or remove authors.

image

In the Authors page you can only see related books. The books list is created with a formula.

image

It would be great if the books could be added and remove also in the Authors page, as in the Book page.

The m-to-m relationship would become fully symmetric.

Thank you again, Emanuele

emanuelegissi avatar Nov 22 '23 10:11 emanuelegissi

Should such a functionality be added, I’d suggest basing it on a join table, like in this sample, instead of a denormalized reference field. That would make it easier to use, for example, with the /sql endpoint.

jperon avatar Nov 22 '23 12:11 jperon

A neat solution for this would be to add support for SQLite Triggers in grist. Relationship tables could be automatically updated by triggers when a reference field is changed. This could also pave the way for more complex automations with grist.

ghost avatar Nov 29 '23 10:11 ghost