Help: Auto-limit RG based on height to overflow items into next group

I’ve been trying to solve this problem for a few months now and I think I’m finally getting somewhere.
Im building a pdf proposal generator. I have a webpage with a “document view” that displays the content that will be exported to a pdf. On this web pages I have two groups that serve as “pdf Pages.” I’ll call those by that name to avoid confusion, but they are just groups on my bubble page that match the proportions of a pdf page.

In PDF Page 1, I have a repeating group that displays marketing content. The problem is that being a group that requires a fixed height and width means that if my RG displays too many items, they will either scroll (which won’t show up on the pdf export) or they will extend the length of the RG and throw off the formatting. I’ve been trying to figure out a way for items to automatically “flow” from one PDF Page to another (or from one Repeating Groups inside the pdf page to another RG).

Some have suggested creating fields in my database for each page, but because of the way this needs to scale, that’s not really a good option.

Right now, I have managed to kind of do it with custom stated. Here is the setup:
My page has 3 custom states: “RG Page 1,” “RG Page 2,” and “RG Page List Buffer”

Repeating group 1’s data source is “RG Page 1”
Repeating group 2’s data source is “RG Page 2”

On Page load, I have a. workflow that sets state of “RG Page 1” as the list of marketing collateral cards from that pages thing in the database.

Then I have a custom workflow that moves the last item of “RG Page 1’s” list to the “Page list buffer” then merges it with “RG Page 2.” This ensures that when an item from the RG gets moved down to the next RG, it appears first on the list, no last. This workflow is conditional and will run “only when” the height of Repeating group 1 exceeds a certain height. (“Repeating group 1’s height > 1065”)

Now here is where I’m running into issues. I really need this to run as a loop which would essentially run until the condition is no longer met. So If there are 15 items in Repeating group 1, but 5 of them have overflowed off the page, I need to run that workflow 5 times so that each item gets moved down. I’d love to move them all at once, but I don’t know how to calculate this. Either way this would run until the height of Repeating group 1 is no longer greater than 1065. I tested this out as a button-triggered workflow and it works. Click the button and the last item in Repeating group 1 gets moved down to Repeating group 2. you can keep clicking the button and it will keep moving items down until they stop meeting the condition of overflowing the 1065 height in the condition.

I know that looping workflows can be done in backend workflows, but my understanding is that this is only true if working in the database whereas this is only just using custom states. So my idea was that maybe I could just repeat the custom workflow (which has its condition built-in) on page load. Like just repeat it 15 times on page load and it should only run the amount of times that it meets the height condition. For some reason this doesn’t work. Oddly, when I added a break point in the workflow and tested it step-by-step, it DID work. but not otherwise.

Can anyone explain to me why this may be? or how to get around it? or how there’s some completely different way to do what im trying to do?

Here is one more thing that’s happening. I added a button to see if the workflow issue was just not working on page load for some reason. The button works if it just runs the workflow once. So you can click the button as many times as needed, which does move items to the next RG page. Once the condition stops being met, the button stops working, which is good. So I tried just repeating the custom workflow a bunch in the button workflow but then it starts ignoring the condition.

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