# Choice Component! how to populate based on previous Selection

**URL:** <https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724>\
**Category:** Ask for Help\
**Created:** [April 19, 2024, 10:36am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724 "2024-04-19T10:36:48Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 19, 2024, 10:36am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/1 "2024-04-19T10:36:48Z")

</div>

Hi! need help

In a custom add form “order” i get product from “product table” using choice component.

Instead of write the quantity in the “order” i want a second choice component, there are only 3 quantity options based on the product from first choice.

Each Product has diferent quantity for each of the 3 options

I do not know how to populate the second choice with this 3 values

3 values for each product but 4 identical groups of quantities

I can filter the second choice based on the name of the first one, would be much better to get that from Product table

Product 1 1kg 3kg 5kg  
Product 2 10Kg 20 kg 30 kg

regards

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 19, 2024, 10:42am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/2 "2024-04-19T10:42:27Z")

</div>

Use Screen Values to filter your Choice Components.

> **[Screen Values | Glide Docs](https://www.glideapps.com/docs/reference/values/screen-values)**
>
> Values that you can access from the current screen.

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 19, 2024, 11:18am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/3 "2024-04-19T11:18:30Z")

</div>

Hi Darren

Thanks! Screen Values works Perfect!

My big issue is to populate this filtered choice component, i can get one value from quantity column in the products table and write to the orders table

I need 3 quantities values associated to each product, showing in the choice, i do not know where to place then. It is 4 groups in total of 3 equal values for each product

Product 1  
A B C ==\> choices would solve with this 3 values in one column of the product table

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 19, 2024, 11:21am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/4 "2024-04-19T11:21:16Z")

</div>

Have you tried enabling multi-select on the Choice component?

This will give you a comma separated list in the target column. You can related that to other tables by first converting it to an array with a split text column, and then use the split text in a relation.

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 19, 2024, 3:42pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/5 "2024-04-19T15:42:08Z")

</div>

Darren,

I did no get that

do i need a helper table?

I am sourcing the Choice with column quantity fine woriking with only one option

Product Table:  
Product quantity  
Product 1 100 would be text not number is enouch =\> working

Product 1 100, 300, 400 only 3 options in the choice

Did not find the way to convert CSV or array or Split to columns

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 19, 2024, 3:59pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/6 "2024-04-19T15:59:56Z")

</div>

Maybe I misunderstood. Can you show me a screen shot of the Data Table you are using for your choice options?

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 19, 2024, 7:40pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/7 "2024-04-19T19:40:40Z")

</div>

Hi Darren,

This is not the app but shows what i need

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/7/97479edf3cc7bb509ddbccba386ff5a1b12ea5db.png)

Source product and quantity

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/d/4d20cceb7745f1ca47013fa3aa15d1ee022bc88a.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/2/02ce2e3baff88326ebe1ee16f694c182f20f5fe2.png)

It Shows only one option in the choice componente i need 3

So how to get 3 values from Products table

Regards,

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [April 19, 2024, 8:50pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/8 "2024-04-19T20:50:34Z")

</div>

Where do you expect to get a list of all choice options for a particular product? I only see one quantity option listed per product in your product table. I don’t see any other table that would list out all of the quantity options. I think you need a seperate table just to list out all quantity options per product or per type of product, but I want to make sure I’m not missing something.

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 19, 2024, 11:04pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/9 "2024-04-19T23:04:15Z")

</div>

Hi Jeff,

Consider each product has 3 packages, in my table only one, i do not know where to put then

Afther choose the product, the second choice component is showing the only package i have in the product table

I would like to see 3 options ro choose one to write in the order table

Regards

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [April 19, 2024, 11:15pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/10 "2024-04-19T23:15:01Z")

</div>

Ok. Would the choices be the same for certain types of products or would they be different for each type of product. What I would suggest is a separate table that has one column with either the product ID or the type of product. Then have a second column with a the value you would use for your choice. Then create a row for each possible product/choice combination.

The choice component relies on each choice item being in a separate row.

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 19, 2024, 11:57pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/11 "2024-04-19T23:57:22Z")

</div>

Hi Jeff

500 products, each product has 3 packages and only 4 groups

Product / Package  
P1 / A B C  
P2 / A B C

P3 / A D G

P4 / H Y U

P500 / G H K

In the order form, choice one get product then choice two only one of the 3 packages related to that product

Maybe i need many tables

Regards

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [April 20, 2024, 12:16am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/12 "2024-04-20T00:16:15Z")

</div>

It can all be one table. You don’t want multiple tables to deal with this.

I mentioned product types previously. Looking at P1 and P2, they both have the same choice options, so I’m imagining that they would belong in the same type or category. Could their be a type or category to group multiple products together and they can share the same choices? Or would a lot of products not share the same choice options?

There’s also another approach which would save on rows. You could still have a separate choice table with two columns. One column would contain every possible choice only listed onceper row. The next column would contain a comma delimited list of all possible product IDs that could use that choice. Then it would just be a matter of pointing the choice component to that table and filter the choices where the comma delimited list of product IDs is included in the product id screen value of the chosen product.

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 20, 2024, 1:08am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/13 "2024-04-20T01:08:11Z")

</div>

Jeff

all 500 Products has one of the only 4 groups (category) of choices, after choice one get the product the Category is defined

Table Products  
Product Category  
p1 Category1

Table Category  
Category1 p1 p2 p3 …  
Category2 p5 p6 p7 …

Table Categry with packaging  
Category1 Category2  
A D  
B E  
C F

So the secong choice would be populated from correspond category i do not know how to do that

this what you were thinking, the category makes a lot of sense

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [April 20, 2024, 8:45pm UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/14 "2024-04-20T20:45:06Z")

</div>

Ok, so here is how I would do it.

- Create a new Choice table.
- Add a column for Categories and another column for Quantities
- Fill the table with with each category and and quantity combination that is possible. If you have 4 categories and 3 quantities for each, that should be 12 rows.
- Add a relation column that links the category column to the category in the products table.
- Add a Lookup column that uses the relation to return an array of matching products for each category.
- Add choice component to your form and set it’s source to the. choice table.
- Add a filter to the choice component where the Lookup column Contains the Screen Value of the selected product in the previous choice component.

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [April 21, 2024, 9:14am UTC](https://community.glideapps.com/t/choice-component-how-to-populate-based-on-previous-selection/72724/15 "2024-04-21T09:14:52Z")

</div>

Hi Jeff

You are great, i lost many many hours, put to work with an aditional step very bad

You did it perfect! So everything is working now

many thanks

regards
