Lemons, apples and !carrots

Hi Folks, I need some help with something. It probably was raised before, but I couldn’t find it at the forum. Sorry.

I have a table which I’ll call “type”:

Type

Fruits
Vegetables
Meat

I have a second table called “food”:
Type | Food

Fruit | Apple
Fruit | Lemon
Meat | Pork
Vegetable | Carrot
Vegetable | Tomato
(type here is referenced)

Now, I would like to have a table called “purchase”

Costumer | Type | Food
Eduardo | Fruits | Apple
Natalie | Vegetable | Carrot

The “wish” here is when I select “Fruits” as a reference, the next selection shows only “Apple” and “Lemon”.

Can I do that?

Thanks in advance! Sorry for asking for something already answered.

Eduardo

1 Like

Hi Eduardo!

Filtering a dropdown based on another column is not currently possible in Grist. A workaround for this is to create multiple linked tables. I walk through how to set this up on another post - check it out here:

I created an example in Grist for you at the link below:

https://public.getgrist.com/3a5c7v15n4Co/Community-1276/m/fork

It’s set up the same way as the other example with Countries and Cities but using the Type and Food options you mentioned above. When you select a Type, the Food table updates to Foods linked to that type. Then, select the Food. After making a selection in both tables, you can add a Purchase for that food. Just add a Consumer to the Purchase table and the Type and Food columns will auto-populate. Note that Type is a reference column but also a formula column. The Purchase table is set up to ‘Select By’ Food so we use the reference column Food to pull the Type for that food.

Let me know if you have any questions!

Thanks,
Natalie

2 Likes

Thanks Natalie! I’ll consider this approach. :smiling_face_with_three_hearts:

1 Like