Hi bubble community,
Im working on a simple questionnaire project.
The client has requested the ability to display a set number of questions per view before going on to the next step. I have done this by assigning each question in the data base a page number. The repeating group then searches for questions that match the current page number, the page number is held in a state that increments by one each time the next button is clicked.
On inspect the group is correctly getting the right question and updating as needed however the text that is displayed remains the same no matter what the inspect states is actually supposed to be displayed.
If the aim is simply to display a series of questions in a specific order but only x number of them at a time, then the following approach should be simpler and more robust…
Instead of a page number being associated with each question, have an “ordinal” field. It can be either numeric or alphanumeric (text). Simply sort by that field when retrieving the questions so that they appear in the desired order.
As for pagination, Bubble already has built-in capabilities for that. Just set the RG Layout style to Fixed number of cells…
Then just use the Show next/previous of a repeating group actions…
Additionally, for a professional touch, you can use a conditional on the next/prev buttons to disable them when the ends of the list have been reached…
Thanks for the reply!
the client has some requirements regarding the number of questions in a section of the survey.
i.e the first section has 12 questions, the next six, the last 20.
I couldn’t find any option for dynamic repeating group fixed number of cells.
the current flow works fine however will occasionally return the questions out of order, not sure why however is not some thing that breaks the required function.
If not, you could use your page number field as both an ordinal and a page grouping. Assuming there are less than 100 questions per page, simply make sure all questions on page 1 are assigned a number between 1 and 100, and all questions on page 2 are assigned a number between 101 and 200, etc. Then, make sure the assigned values represent the desired order within each page.
That way, a single numeric value for each question can be used as both a constraint and a sorting field. For instance, to view page 2, just retrieve all questions whose page value is greater than 100 but less than or equal to 200. And as long as the results are always sorted by the “page value”, the questions will be in the desired order.
Anyway, I realize you said the order per-page wasn’t critical, but this approach would simply require a few logic tweaks and should yield consistent results.
Hi Steve,
That’s actually the same way that i have the results returning, but in much smaller steps, i.e - section 1 page 1 question 1 = value 111
section 2 page 1 question 8 = value 218
still a mystery why it occasionally mixes the order. i cant see any error in the formula.