Group by Field in Repeating Group

Good afternoon,

I have sa Thing called Paper with the following fields:

Paper_Name
Basis Weight

The data looks like this:

Paper 1 - 80gsm
Paper 1 - 100gsm
Paper 1 - 120gsm
Paper 2 - 70gsm
Paper 3 - 80gsm
Paper 3 - 90gsm
Paper 3 - 110gsm
Paper 3 - 130gsm

I want to create a repeating group that shows the following:

Paper1

Paper2

Paper3

Without repeating every entry for each paper. I cannot create a separate thing just for the paper names or just for the weight basis.

Anyone has an idea how to achieve this?

Thank you,

Do I understand you correctly that you have created one data record for each of the variants, that have identical names? If you can’t create separate things, maybe you can save the paper weight as a list of texts instead of a text, to keep it to just one uniquely named paper?

You will have more flexibility if you save them as separate things though (counting, sorting, categorizing, etc), but I assume you have your reasons to avoid it.

Could you use the “unique elements” in your search?

I would normalize it further. The problem I have is that these individual rows will be used to control inventory lines and if I normalize further, due to the nature of Bubble.is I will have a nightmare in my hands in the near future.

Please enlighten me as I have tried to use unique elements and I cannot make it work. I am not being sarcastic… I am really lost when it cames to the usage of unique elements, but that would make sense.

Hey @nunomneto :slight_smile: I’m still practicing this as well, but I think one possible way would be to have the data structure contain three types: Paper, Weight, PaperWeights (to ‘join’ Paper and Weight combinations):

Paper:

Weight:

PaperWeights:

You would then create your Papers (1, 2, 3) as Things, and Weights as Things (80, 100, 120). You could do this manually through the Data tab, or through a workflow on a page:

With the workflows being:

Once you have those stored in the database, you can then create the different combinations of Papers and Weights. To do this through a workflow, you could use two dropdowns which allow you to select a Paper, a Weight, and then the workflow creates a new PaperWeight:

Dropdown Paper’s Settings:

Dropdown Weight’s Settings:

In preview mode, if you were trying to create a combination of Paper 1, and 80 it would look like:

Then the workflow for “Create PaperWeight” creates that combination as a PaperWeight Thing, and then adds that PaperWeight to the Paper’s PaperWeightsList and the Weight’s PaperWeight’s List. *You don’t have to store the combinations on Papers and Weights, but it may come in handy at some point!

Create A New PaperWeight:

Add that PaperWeight to the Paper’s PaperWeightsList:

Add that PaperWeight to the Weight’s PaperWeightsList:

Last but not least! In the repeating group, you can set the type of content to be: Paper, and the data source as “Do A Search for Papers”. Then place a text element in that cell which is “Current cell Paper’s Name”. This will make sure the Paper Name only appears once in the repeating group:

Then in that same cell, place a second nested repeating group beneath the text element of the paper name. Have that repeating group be type PaperWeight, and the data source be Do A Search for PaperWeights, with the constraint in the search being: Paper = Current cell’s Paper. Then place a text element in that cell which is “Current cell’s PaperWeight’s Weight’s Number”. This will make sure that there is a list of Weights available, associated with the cell’s Paper.

And in preview mode, it looks like:


*You could customize the style/text to anything you prefer of course!

I hope this wasn’t too confusing, and feel free to let me know if you have any questions at all. :slight_smile:

More information on structuring these types of things can be found incase you’re interested:

3 Likes

Thank you so much for the detailled response.

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.