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 number of different variants for a product and create the appropriate columns to store the size in an array column (e.g: Size 1, Size 2, Size 3, etc.)
Make another sheet to store the unique variants for all products. I have already solved that thanks to a combination of transpose, arrayformula, trim, split & textjoin.
Make a relation column in Glide that links the array column to the size array sheet and use that as your choice value.
I guess I didnât realize it, but Iâve been doing this (or something very similar) for a while in some of my apps. By using the same basic logic of moving all options to a separate sheet using âUNIQUEâ formulas, I can then create a relation to the User Profile and then lookup the userâs specific choices so that only the ones that theyâve added to their profile are available. I use this for employeesâ jobs⌠people at my organization can have more than one job title, so theyâre able to add multiple jobs to their profile, then when theyâre filling out a form, they have a choice component that only displays their jobs as choices.
If row count is not an issue for you, you can add those options in an extra table and use a multiple-relation/filter for them to use in your choice component.
Something like:
Dish | Option
Pizza | Extra Cheese
Pizza | Extra Veggies
Ice Cream | Cone
Ice Cream | Cup