Create one line for each element in a column

Hello !
I’m just getting started with Grist coming from traditional spreadsheet and I’m delighted by all the features.
I have a question concerning the creation of new lines automatically.
I have a column containing lists of element in a given table 1. I would like to create table 2 that would have a line for each element (no need to de-duplicate) of those lists and that would grow every time an element is added to the initial table

Table 1 :

name favorite colors
John [ red, green, blue, yellow ]
Alice [ black, orange, pink ]

Table 2 :

id color
1 red
2 green
3 blue
etc…

How can I manage it ? Thanks by advance !

Define you favorite colors column as Reference List to Table2, and Show column as color. Sample here. When you add a new color in favorite colors, just click on + to have it added:

Thank you for your answer @jperon !

It won’t apply in my situation (I used the color example as a simplification)
I need the source of the data to be the first table (the content of the list is the result of a formula) and to have the second table’s lines created automatically (without having to create a new line and select a value each time).

Could you make a sample available on docs.getgrist.com, and make it publicly accessible? I’d understand better the problem.
Generally speaking, automatically creating lines needs custom widgets, especially Action button.

Of course. Here is an exemple

I would like to be able to add a year in a first table and have one line created for each associated month in the second one (in the current setup all the month from october 2022 to october 2024)

Please enable public access, so that I can see/edit it :slight_smile: .

:person_facepalming: Oh… I thought I had done it, here it is again
I’m going to look at the Action Button feature.

Here you are. I don’t know whether you need the Month column of Table1 for anything else than calculating what should be added to Month table: if not, you could replace $Month by [DATEADD($Start, 0, i, 0, 0) for i in range(12)] in Action formula, and delete Month column.

Oh that’s great ! Thank you ! (and the duplicate option will be a very good bonus !)

By the way, I was experimenting with the action button and was currently blocked by a " “ActionButton” cells should contain an object with keys “button”, “description”, “actions”. Missing keys: “button”, “description”, “actions”" (in the sample I gave earlier, I changed it to fully public with edition rights).
Would you know why ? So I can get the hang of it for a next button

It comes from the type of your ActionButton column: set it to “Any”. By the way, though poorly documented, BulkAddRecord is more efficient when you have several things to add.

1 Like

Thank you ! Have a nice day :slight_smile:

You’re welcome. Enjoy with this great tool!

1 Like