Counting backward from Last Item of a list

Hi Bubblers,

I know there’s a “Count” function in Bubble editor. But does anyone know how I can count backward from a list?

The reason I asked is because I have a list of data and I want to display only the last 10 items without having it displayed in reverse order.

So, for example, let say I have a list of 100 numbers. I want it to display…

“90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100”

And not

“100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90”

Appreciate the help!

Hi!

My be this will be the required option for u

21 actions there in db, check it

2 Likes

Interesting.

Is “Number in Rows” a Bubble operator or a data field in your Data Thing?

Data field. You can call it as ID (hand made one). Here as an example only :innocent:

1 Like

Ok. Let me give that a try…

In case with static data from database i was using “created date” for sorting from latest to newest - you are able to do so as well not to create new field and fill db up

1 Like

Set a state (number) to be the count of the number of items - 9

The use “:items from” that state.

Note that you will need to use a state as Bubble doesn’t like you doing :count - 9 in the search for some reason.

Hi @malikinoleg2008,

I tried to follow your screen shot, but it doesn’t seem to work.

First, I’m not using this in a Repeating Group. I’m using it on a chart, specifically ChartJS so I need to define the exact data field that I need to display. In a repeating group, each cell you can define a data thing. But in a chart, I have to define the exact data field that needs to be displayed.

Second, my data is not from Bubble’s native database. It is actually from Google Sheets using SheetDB API. Although I think in principle it should be the same, but for some reason, the Bubble editor doesn’t recognize my “Number in row” as number.

Is this requirement very uncommon? Can’t believe it is so difficult to figure this out…

In this case you are able to realize it on google sheet side. Create new sheet where you will display last 10 rows from the main page and shift API there. That’s the best and common way in this case

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