Arraycolumn relation within one table

Hi there,

I have a table of products with multiple columns for various sizes of that product. So, for examples, one row is T-shirt, with Size 1 column as Small, Size 2 columns as Medium, etc. In the data editor in Glide, the columns combine to one column with what looks like a relation column. However, I am unable to list that relation list while editing the Layout for the T-shirt record. Is that possible? I’d like to be able to go to T-shirt (or pants, or shorts, etc), and see all of the various sizes as a list.

Thank you,

You created an array column because of the sequential numbering. The icon is the same as a relation, but it is not a relation and has a completely different function. Underlying is still the individual columns. If you want to display the various sizes, just add a component for each individual size column. If you wanted to use a list, then you would need to create a separate sheet that lists the clothing item and each size on separate rows. Then create a relation from the clothing sheet to the new sheet, so you could display the relation as a list. It’s a lot of extra work and would eat up a lot of rows just to display a list of sizes when you could simply just add a component for each size column instead.

Hi there @BryanMitchiner, how are you?

In the “Size 1 Small”, “Size 2 Medium” … columns, what is the nature of the data: integers (basically the quantity in stock)? I ask to understand better what you are trying to achieve in the front-end.

If this is the case, I believe you are trying to achieve the following experience:

  • The user is on the products page: this page includes a list of products and the page is built with one of the list layouts (possibly tile ou card layout) or with a details layout with inline lists (here again, possibly in tile or card layout).
  • The user taps a product (= an item in the list), for example “T-shirt”.
  • The user is led to the item’s screen and there the user can see what sizes are available and what is the available stock.

If this is the behavior you are looking for, I would do as follows (basically what @Jeff_Hager suggests):

  • In the Glide data editor, create columns “Small”, “Medium”, …
  • Populate your columns with your data: integers which represent quantities available.
  • In the design layout of your item, I would use the “Basic table” component and create one line per size. This component suits this use case well as you can display the data (quantity) to the right of the attribute name (the header of your column).

Use case to name your columns “Size 1”, “Size 2”, etc.

  • In my understanding, this use case is quite different to the one described above. You would do this to categorize your products.
  • The data in the cells in column “Size 1” would for instance say “Small” for each product that is available in that size. In the “Size 2” column, you would indicate “Medium”. And so on.
  • Thanks to the array column, you would then be able to inform your users which products are available in the “Small” category.

I hope this helps somehow.

1 Like

Thanks, @Jeff_Hager and @nathanaelb.

It sounds like the only way to do it is via Jeff’s strategy… because the scenario is a bit different than I described. It’s actually that I have different shaped bottles, and I want to display what sizes are available for each shape. That is, I have Bottle A, Bottle B, and Bottle C. A is available in 2 oz, 4 oz and 8 oz, B is available in 4 oz, 9 oz, 16 oz, 32 oz, and C is available in 1 oz, 2 oz, 3 oz, 4 oz, all the way to 10 oz.

So, is this correct…? In order to display all the various sizes, I’d either have to 1) do a separate table of the unique sizes and draw a relation between the bottles table and the size table OR 2) display each size column as a separate component OR 3) create a separate Bottle entry in the bottle table for each size and draw a relation between the same bottles in the bottle table.

As Jeff alluded to, I’m trying to limit the number of rows, so each new bottle + size combination doesn’t require its own line item.

Yes, those are correct assumptions. I would stick with the multiple columns like you already have. No need to change heading names or anything. Then add a basic table component to display each size by setting each individual column in the component settings.

1 Like

I agree with @Jeff_Hager. Stick to option 2), although I would amend your sentence to “Display the data in the size columns as one or more components.”

The basic table component is one component that displays multiple item attributes.

1 Like

Thanks, gentlemen.


This was solved here.

1 Like