# Sizes from one worksheet in choices component of other worksheet

**URL:** <https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100>\
**Category:** Ask for Help\
**Created:** [July 7, 2020, 12:39pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100 "2020-07-07T12:39:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![applemooz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/applemooz/32/1576_2.png) [@applemooz](https://community.glideapps.com/u/applemooz)\
**Post date:** [July 7, 2020, 12:39pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/1 "2020-07-07T12:39:21Z")

</div>

I have a worksheet with available sizes from a product. The column is named sizes and it is in this format: S,M,L.

I have a form setup (different worksheet named form), where I want customers to make a selection from the choice component. So they would be able to choose either S, M or L and submit that choice in the form.

So far I have no clue how to get the available sizes data into the choice component of the form.  
Tried with relations but somehow that does not work here.  
Any guidance or help is appreciated!

---

<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:** [July 7, 2020, 1:34pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/2 "2020-07-07T13:34:38Z")

</div>

Assuming you have a products sheet, a sizes sheet, and the form sheet, correct? It sounds like you have a multiple relation from the products sheet to the sizes sheet? You should only need a form button on the product details page. Open the form and add a choice component. For the data source of the choice component, set it to the relation you created to link the product sheet to the size sheet.

---

<div class="post-metadata">

**Author:** ![applemooz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/applemooz/32/1576_2.png) [@applemooz](https://community.glideapps.com/u/applemooz)\
**Post date:** [July 7, 2020, 1:52pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/3 "2020-07-07T13:52:17Z")

</div>

no, just a product sheet and a form sheet.  
The sizes are in a column in the product sheet (coming from an xml feed).

---

<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:** [July 7, 2020, 2:16pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/4 "2020-07-07T14:16:42Z")

</div>

How many different unique combinations of sizes would you have? (Ex. ‘S,M,L’; ‘S,L’; ‘M,L’; etc.)

---

<div class="post-metadata">

**Author:** ![applemooz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/applemooz/32/1576_2.png) [@applemooz](https://community.glideapps.com/u/applemooz)\
**Post date:** [July 7, 2020, 3:01pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/5 "2020-07-07T15:01:37Z")

</div>

we have about 100 sizes, so that would be an impossible venture to make all combinations from them.  
Is there no way to display a field value from a differtent worksheet, or does this just only work through relations?

---

<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:** [July 7, 2020, 3:27pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/6 "2020-07-07T15:27:08Z")

</div>

I’ll have to think about this. To be clear, the sizes are listed in a single column for each product with a comma delimiter between each size?

---

<div class="post-metadata">

**Author:** ![applemooz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/applemooz/32/1576_2.png) [@applemooz](https://community.glideapps.com/u/applemooz)\
**Post date:** [July 7, 2020, 3:48pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/7 "2020-07-07T15:48:54Z")

</div>

Yes, correct.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 7, 2020, 3:58pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/8 "2020-07-07T15:58:58Z")

</div>

I was talking about this in a thread like 2 weeks ago with the same problem. It would be nice if we can split that to multiple columns in an array column format, then make that array column the choice value, but obviously that does not work as of now.

---

<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:** [July 7, 2020, 4:06pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/9 "2020-07-07T16:06:05Z")

</div>

@ThinhDinh Yeah, that’s kind of what I want to double check on when I get to a computer. I’m wondering if some weird split/transpose/unique or query formula could give us a list in a new sheet that could be linked to with a relation to build the list of sizes for the choice component.

@applemooz Can you share a small sample of your data? Screenshot should be fine.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 7, 2020, 4:18pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/10 "2020-07-07T16:18:37Z")

</div>

If we have each combination of product ID and size choice in a row then it would work, but it will eat up a lot of rows.

If Karl still wants to go that way, then I think after splitting & trimming the choices into multiple columns in the original sheet, we can transform that to a new sheet with multiple lines by something like.

```
={FILTER({ProductID Column; Size 1 Column}, Size 1 Column <>"");FILTER({ProductID Column; Size 2 Column}, Size 2 Column <>"")}

```

It might work stacking it on each other like this, an Array literal problem can come up, but that’s my best bet now.

---

<div class="post-metadata">

**Author:** ![applemooz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/applemooz/32/1576_2.png) [@applemooz](https://community.glideapps.com/u/applemooz)\
**Post date:** [July 7, 2020, 4:22pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/11 "2020-07-07T16:22:32Z")

</div>

![Untitled-10](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/8/8dd9506e0634d01fd52c8f5649d23348e9c67ff3.png)

Is this enough for you?

---

<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:** [July 7, 2020, 4:24pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/12 "2020-07-07T16:24:38Z")

</div>

Yep, that will be good. I’ll play around later today.

---

<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:** [July 8, 2020, 3:15am UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/13 "2020-07-08T03:15:33Z")

</div>

@ThinhDinh Maybe you have an idea on this. I have a formula that works to take a product in one column and a comma delimited list in another column and build a list of sizes for each product in separate rows, but I’m running into issues when splitting cells that have numbers for each size. It seems like the split doesn’t work. I think it’s because the result of the split is a number, but I don’t understand why. It happens when it runs into the row that contains “31,32,33”. Thinking that maybe the comma with a number was causing an issue, I did a substitute to convert commas to pipes, but that didn’t seem to help.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/8/8a7a1983dcbb6efee5f67232a4f408eafd17acf4.png)

I shared a sheet here.

> **[Sizes](https://docs.google.com/spreadsheets/d/1JL9H9TVkvdcawdzmRvCutiA3N8Ey7A7doRgrwOFDPs4/edit?usp=sharing)**
>
> Sheet16
> 
> Product ID,Size,SizeText,1,one size
> 1,one size, one size,one size| one size,1,one...

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 8, 2020, 8:36am UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/14 "2020-07-08T08:36:26Z")

</div>

Hi Jeff, it’s a bit strange I can’t get the “text” options to be splitted out (as in one size, L, M etc.), the original formula can only return the numbers.

Ultimately, I had to make it a 2-step solution, first getting everything including the rows with empty Col2, then a filter to filter out those rows. Query did not work.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/8/8e1e61f82597ed4c3a502bafb6065d1b7a120f15.png)

---

<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:** [July 11, 2020, 3:03pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/15 "2020-07-11T15:03:27Z")

</div>

Yeah, I don’t know why the formula is acting the way it is.

I just had another thought though. Figure out the max number of sizes a product could have. Let’s say 10. Create 10 columns in an array format (Size 1, Size 2, Size 3, etc.). In the first array column create an array formula with Split to split the sizes on comma into each array column for each product. Create a new sheet that lists each possible unique size on a row. Maybe a this could be done with a formula automatically or just manually entered.

Now on the products sheet in glide, create a relation that links the array size column to the size column in the new sizes sheet. This should give you only the matching sizes for the product that can be used in a choice component.

I haven’t tested this and I will have limited computer access over the next week, so I don’t know if we would run into similar issues from my first idea, but it should result in a lot less rows used to build the choices.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 11, 2020, 3:05pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/16 "2020-07-11T15:05:31Z")

</div>

Thanks for the idea, I will test it later.

---

<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:** [July 11, 2020, 3:08pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/17 "2020-07-11T15:08:41Z")

</div>

Feel free to use the same sheet.

---

<div class="post-metadata">

**Author:** ![applemooz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/applemooz/32/1576_2.png) [@applemooz](https://community.glideapps.com/u/applemooz)\
**Post date:** [July 11, 2020, 6:21pm UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/18 "2020-07-11T18:21:50Z")

</div>

Thanks so much for looking into this guys!

So I managed to get the sizes in an array column on the product sheet.  
I did this with help of [parabola.io](http://parabola.io), I used it to split the comma separated values in different columns as you suggested (size1,size2,size3 etc.)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/1/164b195356cc69ee91662131aac384604261a6bb.png)

How would I go from here in displaying this sizes array on my product page ?  
I can only see the different sizes to pick from (size1 or size2 or size3 etc.)

And after that I would need the choice option in my form, how would I make that relation?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 12, 2020, 1:06am UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/19 "2020-07-12T01:06:02Z")

</div>

This will not work because as of now you can’t use an array column for your choice value.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 12, 2020, 2:11am UTC](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/20 "2020-07-12T02:11:39Z")

</div>

Here, we have solved it.

> [@Solved: Dynamic product variants in choice component](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/):
>
> Thanks to the brilliant @Jeff_Hager, we have now successfully implemented a dynamic product variant choice component. It was started from this discussion. Based on this discussion and what Jeff and me worked on in the Sheets, I created an app that you can copy to work on for your own apps. Basically you need to have: A column that contains all sizes, separated by a comma (or you can change the separator in the formula if you have an existing one that is not a comma) Determine the max n…

[Next page](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100.md?page=2)
