Split up repeating group into multiple by count of results

For example if I have a repeating group that returns a 1000 results, is there a way to turn this into one repeating group with items 1-99, another repeating group 100-199, and so on? And somehow make this automatically scaling instead of manually creating repeating groups for each chunk of numbers?

The purpose of this is because every PDF generator it seems can’t handle multi-page reports. So instead I’m thinking just setting up each page with exact dimensions but I need a long repeating group to split up nicely on each page with a header/footer without getting cut off from one page to the next.

Never mind I was able to figure it out using the Toolbox plugin and using the number generator element.
If anyone runs into this question let me know and I can hopefully explain it.

The basic idea was if I have a list of a 100 things, show items 1-25 on one repeating group, then show 26-50 on the next, 51-75 on the next, and shoe 76-100 on the last one. Then have other elements before and after each group of items so I can have a header, footer page number, etc.

@tylerboodman Hello Tyler, thanks for posting on this. I need to figure this out for myself, because I’m going to add more data for the item in Index #1, versus Index #2 / #3, then Index #4 / #5 / #6. I know I can do a search then control what Index # the repeating group starts, but I am concerned with doing multiple searches in case there has been changes to the DB between one search and the next. (Is that an issure?) If you don’t mind, if you’re still active, I’d appreciate more details on how you solved your problem. Thanks!

Hey @dankeenan2004

I’ll be honest I don’t think I’m following with what you’re trying to do… :laughing:

In my example I needed to take a list of 1000 things, split them into RGs each with 30 items, where each one continues from the last one. So I could put each RG on a page and make a PDF. Is that what you’re trying to do?

In Bubble, the database is realtime so any changes made will be reflected in all RGs, even after the search was done. If I’m reading what you said correctly?

Thanks for the quick reply @tylerboodman,

I am trying to figure out how to have a single column repeating group for Item 1, then another repeating group for Items 2 & 3, with 2 columns, and then another repeating group with 3 columns for Items 4, 5 and 6. Like a pyramid in shape.

I think I know how to do it now: Create a Repeating Group with a single row, do the search, set the RG to single column, single Item (Items 1 through Items 1). Then do the search again and set the RG to two colums, and Items 2 through Items 3, for one row only. And so on.

Does that make sense to you? My preference is to do ONE SEARCH, and use the data gathered in each of the three, or so, RGs I create in order to get the 1, 2 and 3 column RGs that help me build the pyramind shape of data. otherwise the search may be different results.

Can you see how to do one search and break it up amongst a few different RGs?

Thank you! Dan

Something like this? Bubble | No-code apps

Editor link: tylerboodman-test-app | Bubble Editor

  • RG called “Original Search” that does the full item search. It’s sorting by a number field but this could be sorted by name or whatever other field you have.
  • List of Numbers element (Toolbox plugin) making the arbitrary list of numbers to make the RG rows. The max # is the formula to get the # of rows in a pyramid for the total item count.
  • Inside the RG cell is another RG filtering the Original Search and starting from the math equation to find the first # of that specific row.

You will need parenthesis enabled in your app settings if you haven’t already

@tylerboodman You did that quickly - it looks excellent! Thank you for taking the time to make this and share it! I’m going to dig around to understand what’s going on, and how to get it done on my site. The tricky part is that I want the the number of columns to stop when the number of columns hit 4, then have 4 column per row from on until a max item count that’s TBD. I’ll look into the way you worked it out and see if I can find it myself. Thank you Tyler!

Yea play with it some more, if you are able to just put the row #'s in your data structure just have the RG inside the pyramid search for things where the Row # = Current cell's number (or index)

My way didn’t rely on anything being added to the database since it would use the [datasource list]:items from #[math equation]:items until # to limit which ones are displayed on each row

Not to sure, what you mean… :laughing: I’m sure there’s some math to play with to make that happen

Thanks! I should have said it this way - I just want the pyramid base to stop expanding after there are four items in a row, so each row after has only four rows. I’ll work on that. No more questions from me for a while! You’ve done a bunch already. :grinning:

@tylerboodman, because of your reply and help I was able to figure out a simple way to get it done. I still do not completely understand how the List of Numbers works to control row width, but I have learned a lot. The trick you did of using a separate RG to perform the Search, then referencing from other RGs, was the trick I needed. I’ve been able to create a static structure of four RGs, that allow me to populate row 1, 2, 3, and 4 and rows beyond, in a clean way. You helped me get over this hump! Thank you! Dan

1 Like

Hey @tylerboodman ,

I’m having the exact same problem as you and have been trying to find a solution for weeks now. I’m relatively new to Bubble, so I hope that with a little explanation of my situation, you can help me fix my issue.

I’m having a popup where customers can create a PDF with data that is pulled in from my database. They also have the option to input their own comments at the bottom of the PDF (with unlimited comments that they can add). These comments are shown up in a repeating group, and so they vary in height. I have set up an outer group to this repeating group that is set to the maximum allowable height for a page (so it doesn’t get cut off when the PDF is generated).

The only problem I’m running into now is the fact that I don’t know how to have it cut off when the height is reached, and then continue on the next page. I also have headers and footers on my page.

This explanation might not be clear, and I’m more than happy to give a more in depth explanation. Any information you can give me on how you did it, would be much appreciated!

Thanks