I get all the way to the Data Formats and then Select Collections - my screen look very different from the tutorial and I don’t see the Count options what am I doing wrong ?
Mike, you are using a paged query … select the #total
available there. It will return the number of the records.
Thats because you are using a paged query. Paged queries simply use the #total value.
You’re going to have to tell me how to do that #total from where ?
ok thanks that was easy enough - how would I add 1 - 25 of #total
What is 1 - 25 supposed to be in your example?
Meaning the paging is showing records 1-25 of 3450 total records
Right under #total you will see page … open tthat one up and you will see current and ttottal
you lost me on that one
Mike, you need to add some calculations.
You have the current offset, as well as the limit per page.
So current offset + 1 will be the starting record on the page.
current offset + limit per page will be the last record on the page.
Looking at your screenshots you need to add:
Records {{paging.data.query1.offset+1}} - {{paging.data.query1.offset + paging.data.query1.limit}}
Simple math.
Sometimes not every specific use case you need will be documented the exact way you need it. Sometimes you just need to look what’s available and use it according to your needs. Everything is following simple logic.
This is the calculation I use, but I’ve been meaning to improve it a little, to avoid the problem you’re likely to have on the last page (to be a bit pedantic):
I think this rather lengthy calculation solves this probem:
{{paging.data.query1.offset+1}} - {{paging.data.query1.page.current != paging.data.query1.page.total?paging.data.query1.offset + paging.data.query1.limit:paging.data.query1.offset +(paging.data.query1.total % query.offset)}}
(Or perhaps there is more concise method.)
Thank you all for help on this - to be frank I’m surprised this is no a build in function anyways. This is where third party add ons or extensions within Wappler would make a tremendous amount of sense.
I think it would be useful to be able to store expressions like this in a snippets panel (for which requests have been made). I’m not sure about a third-party add-on. What would it do, except provide the relevant expression?
By the way, the second expression I suggested can be simplified a little - by including
paging.data.query1.offset
just once, at the beginning.
Your calculation for paging worked and as you thought the last page had some issues -
3400 - NaN of 3420 Total Records
is there a way to do a show if or else
Show if != - NaN of else - 3420 of 3420 Total Records that way it would display like this
3400-3420 of 3420 Total Records
At this point I will be saving your snippet as I agree it is something that should be added to WAPPLER
Well of course there is a way to do this.
You can check if you are on the last page, and if yes, show the total number of records as:
3400-3420 of 3420 Total Records
The only issue I had was that the totals shown on the last page might show an incorrect total, as shown in my screenshot. You can certainly show any part of the page conditionally - eg I don’t show navigation buttons/totals if there are no more record to show.
You can use Show or Hide Dynamic Attributes:
what the Show if else structure to use within Wappler ?
In other words how would one do that
As you can expect, this is located in the dynamic attributes, under the display category - show or hide option.
It’s already explained in the following tutorial:
I have selected this section of the code to not show
But now I can’t find the Dynamic Attributes
How can I find that ?