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.
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!).
Preview:
Editor:
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
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
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.
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
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.
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.
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.