:item from# :item until#

I have been working on my search functionality and pagination within the results set and made good progress, but hit a road block that I cannot get my head around.

To simplify testing I used small record sets and set paging size to small numbers. In theory if the setup is correct it wont matter the page size it should just work.

I make an initial query to determine the record count of the results set and then set a bunch of states in the Pagination control I have built. These include RecordCount, ItemsPerPage, Pages Available, Current Page, ItemFrom and ItemTo.

After these are set, I use them to display in a repeating group the query but add the :item from and :item until operators.

Having read the documentation and done a few checks to determine which order the method chaining does work, I worked out that I need to perform the :item until first and then the :item from.

With a ItemsPerPage of 1 and ResultsCount of 5 it correctly sets up Pages available to 5 and Current Page to 1, the Page Next simply increments the item until and item from and re-displays in the group.

The problem I have is the number of records displayed on each page are as follows;
Page 1: 1
Page 2: 2
Page 3: 3
Page 4: 2
Page 5: 1

So, the question is, am I using the :item until and :item from correctly in the right order in the same statement? I’ve been on this for hours today and it is really frustrating! I am sure I have been staring at this so long, and tried so many different things that I cannot see the wood for the trees now. :tired_face:

Hey Dave I may not be understanding this correctly, but are you trying to display search results in a repeating group, and then display the next set of results within the repeating group when a different ‘page number’ is clicked? Instead of using ‘next’ and ‘previous’ buttons?

I just tried working on this for a while and I think I got something working (I hope!).



I created two data types “Entry” (containing one field: “Name”, type: text, list: no) and “Page Number” (containing one field: “Number”, type: number, list: no). The main repeating group does a search for Entries, and there is a repeating group beneath it which does a search for Page Numbers and displays them 3 at a time.

On page load, I used custom states to count total the number of results in the Entry Repeating Group, and divided that by the number of rows in that repeating group which equals the Repeating Group’s “Number of Pages”.

The Page Number repeating group will only display numbers less than or equal to the Entry Repeating Group’s Number of Pages:

On page load, I set the Entry Repeating Group’s Current Page to 1. Then when a next arrow, back arrow, or ‘number’ within the Page Number repeating group is clicked, it will ‘go to page’ in both repeating groups (Entry and Page Number) and continue to set the state of the Current Page number custom state. Not sure if this is what you’re looking to do, but just incase it may help :slight_smile:


Thanks for that Faye, but that is using fixed list. and the Goto page functionality.

I am using an Extending Vertical List, hence the reason to try and get the :from and :until operators in the search query working correctly.

I want to fully understand the use of these operators and that is where I am banging my head and can’t get it to do what I want. I am beginning to think that they do not support method chaining and are simply overriding each other depending on the order they are put into the query…but I’m not 100% as to what is exactly going on.

More play to do…at least you have a nice paging example now in the ForumApp for others :slight_smile:

Ohh! I see :slight_smile: That sounds like a very interesting problem to solve! Will follow along, and hope you find a solution!

Bubble tends to work left to right.

So if you have “From item” as 3 … and “To Item” as 5 … it thinks you mean 5 on from 3.

The solution is therefore to subtract your “From Item” number from your “To Item” and add 1 and use that in your search as “:ToItem”.

1 Like

Thanks @NigelG, I have redesigned the page for now, but will try again later on another page which is planned.

Ok, I have made a demo page using a simple list, and it definitely does not do as I would expect from the definitions of the operators.

See the page here: https://dave-auld-demo-stuff.bubbleapps.io/version-test/fromuntildemo?debug_mode=true

It appears that the order of the From Until or Until From does not matter, and Until is actually the number of items to return after the from! So, if From is 5 and Until is 10, it does not return 5,6,7,8,9 it returns 5,6,7,8,9,10,11,12,13,14

I’m not convinced it is working correctly for both operators being present in the statement, and which way round they are.

@NigelG does that make sense, or am I miles out on the expectations based on the definitions and potential method chaining.

1 Like

Yeah, you are right, “until x” is x on from then item in “from”.

Or rather until #10 in the list that has been adjusted by the from.

So I guess the question is … is that working as intended (in which case we can ask for some wording updates) or should it work as it looks like it is described. Only @emmanuel can tell us :slight_smile:

It sounds going to be from the from. It reads as this

(List: from n): to m

Returns a sub list from the original list, from the first item to the Nth one.

So I think the wording around “original list” is unclear ?

1,2,3,4,5,6,7,8,9 = the original list. So “Until 5” will give you … 5.

However if you do a “From 2” … the “Until” isn’t operating on the original list … is operating on a new list …

2,3,4,5,6,7,8,9 … “Until 5” is now 6.

1 Like

And that is where I’m coming from, the method chaining should be acting on the result of the previous operator, so by switching the order of the From and Until should be making a difference to the output, however it doesn’t.

I tried to find to some example on some of the other databases operators e.g. Mongo or whatever, but haven’t found time.

Whilst I agree it isn’t all that clear how it works …

“Method Chaining” is all a bit code-y. Most people who use bubble are not coders, so I would suggest it should work in the way they would expect it to work, rather than how someone technical expects it to work.

It is fairly confusing as it is.


I share your pain as the theory behind item until would be that i want to label it as item until the specific number; meaning I want items from 31 until items 60, we as humans would natural assume the bubble “item until” should be 60 but in fact it needs to always be the number of results you want to have.

So in my app, which is set the same way as yours with custom states for the math, I have set the items until custom state to always be equal to the number of results I want displayed on page…now it works exactly as intended.

Page 1 shows items 1-30
Page 2 shows items 31-60
Page 3 shows items 61-90

because my items until is always 30 bubble does the math by saying

items from + items until = last item in list to be displayed

originally I had same set up as you and was confused…wrote on paper what was happening, saw the multiplication of my values for item until and couldn’t figure it out…read this post, specifically from Nigel and got it.

Thanks! This solution worked to me!