# Reapeating Group Best Practices and challange :)

**URL:** <https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236>\
**Category:** Database\
**Created:** [October 20, 2023, 10:30am UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236 "2023-10-20T10:30:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![michal.friedrich](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/michal.friedrich/32/245543_2.png) [@michal.friedrich](https://forum.bubble.io/u/michal.friedrich)\
**Post date:** [October 20, 2023, 10:30am UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/1 "2023-10-20T10:30:06Z")

</div>

I have some issues regarding the Repeating Group solutions and I would like to discuss them.

I am building a repeating group displaying client orders and I would like to know which way to go.

1. Regarding the **repeating group pagination** (I want to display 15 items, have 5 buttons to switch (first, -1, current, +1, last) - what is the best approach - custom states, toolbox or some other solutions?  
I want speed but also simplicity in programing as I need to program many pagination pages.

2. Regarding **marking first and last items on the list** - I can easily create condition for item index 1 - which is alwasy the first, but is there a way, without using workflow to create a custom state, a way to refer to a last item index nr?

Would welcome any feedback 🙂

---

<div class="post-metadata">

**Author:** ![georgecollier](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/georgecollier/32/182327_2.png) [@georgecollier](https://forum.bubble.io/u/georgecollier)\
**Post date:** [October 20, 2023, 11:04am UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/2 "2023-10-20T11:04:29Z")

</div>

> [@michal.friedrich](#):
>
> what is the best approach - custom states, toolbox or some other solutions?

None of the above. Each button just has a different workflow (go to page 1, go to page current page number - 1, go to page current page number, go to page current page number + 1, and go to last page. Make sure the -1/+1 buttons aren’t clickable if it’s on the firstpage/last page respectively.

> [@michal.friedrich](#):
>
> way to refer to a last item index nr

Index = repeating group’s list of X:count is the last item of the repeating group

---

<div class="post-metadata">

**Author:** ![michal.friedrich](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/michal.friedrich/32/245543_2.png) [@michal.friedrich](https://forum.bubble.io/u/michal.friedrich)\
**Post date:** [October 20, 2023, 11:17am UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/3 "2023-10-20T11:17:03Z")

</div>

> [@georgecollier](#):
>
> None of the above. Each button just has a different workflow (go to page 1, go to page current page number - 1, go to page current page number, go to page current page number + 1, and go to last page. Make sure the -1/+1 buttons aren’t clickable if it’s on the firstpage/last page respectively.

Regarding this part - Of course, every button has a workflow. I get what you mean is functionality based on the in build page nrs of a a repeating group correct?

![image](https://us1.discourse-cdn.com/bubble/original/3X/4/d/4dd21243604d59f1cd1d884f9ed1c89b155fb75b.png)

But does the repeating group have the page count parameter - as I need to hide some buttons depending on the item count (especially that they can be filtered from 100 pages to just 1).  
Or maybe I do not need the total count to display them properly…

---

<div class="post-metadata">

**Author:** ![georgecollier](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/georgecollier/32/182327_2.png) [@georgecollier](https://forum.bubble.io/u/georgecollier)\
**Post date:** [October 20, 2023, 11:18am UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/4 "2023-10-20T11:18:27Z")

</div>

> [@michal.friedrich](#):
>
> I get what you mean is functionality based on the in build page nrs of a a repeating group correct?

Yes

> [@michal.friedrich](#):
>
> But does the repeating group have the page count parameter - as I need to hide some buttons depending on the item count

Page count is just RG’s List of X:count / [items per page]:ceiling (rounded up)

---

<div class="post-metadata">

**Author:** ![michal.friedrich](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/michal.friedrich/32/245543_2.png) [@michal.friedrich](https://forum.bubble.io/u/michal.friedrich)\
**Post date:** [October 20, 2023, 12:05pm UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/5 "2023-10-20T12:05:14Z")

</div>

And out of curiosity - what is the bestway to refer to number of currently displayed elements (ex. 30-45 out of 155) - can I address that with this page nrs as well? (as I was using some complicated custom state logic 🙂 )

---

<div class="post-metadata">

**Author:** ![georgecollier](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/georgecollier/32/182327_2.png) [@georgecollier](https://forum.bubble.io/u/georgecollier)\
**Post date:** [October 20, 2023, 12:53pm UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/6 "2023-10-20T12:53:03Z")

</div>

> [@michal.friedrich](#):
>
> can I address that with this page nrs as well? (as I was using some complicated custom state logic 🙂 )

Start of page item # is (1 + ((RG’s page number-1) \* number of item’s per page))

End of page item # is (number of item’s per page + ((RG’s page number-1) \* number of item’s per page))

---

<div class="post-metadata">

**Author:** ![michal.friedrich](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/michal.friedrich/32/245543_2.png) [@michal.friedrich](https://forum.bubble.io/u/michal.friedrich)\
**Post date:** [October 20, 2023, 1:06pm UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/7 "2023-10-20T13:06:35Z")

</div>

Many, many thanks George!

And now I removed the state I created called **current page** - so how can I make +1 without having it in the program. As is there a way to refer to a page we are on, without it?  
(I was sure it was added as a feature, but then realized it was my own creted custom state 😃 )

---

<div class="post-metadata">

**Author:** ![georgecollier](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/georgecollier/32/182327_2.png) [@georgecollier](https://forum.bubble.io/u/georgecollier)\
**Post date:** [October 20, 2023, 1:13pm UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/8 "2023-10-20T13:13:18Z")

</div>

> [@michal.friedrich](#):
>
> how can I make +1 without having it in the program

Go to next of repeating group

The expressions might look scary to display the first and last item number on each RG page but it’s way more maintainable than manually setting the first and last item number every time you change the RG page. Even better if you use a variable for the number of items per page rather than hard coding it multiple times so that if you change the number of items per page you only have to update the RG settings and the variable itself.

---

<div class="post-metadata">

**Author:** ![draked123](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/draked123/32/262422_2.png) [@draked123](https://forum.bubble.io/u/draked123)\
**Post date:** [October 20, 2023, 1:17pm UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/9 "2023-10-20T13:17:03Z")

</div>

You could have an invisible group and give it a name so you know its a variable, type of content to be number, and then put that dynamic expression in (`RG's List of Things:count / [items per page]:ceiling`).

After that, you have a variable that is easily referenced and updated.

Okay, not sure if I gave absolutely any value or if I even helped answer the last part of the question, but it was worth a valiant effort.

---

<div class="post-metadata">

**Author:** ![michal.friedrich](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/michal.friedrich/32/245543_2.png) [@michal.friedrich](https://forum.bubble.io/u/michal.friedrich)\
**Post date:** [October 23, 2023, 7:31am UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/10 "2023-10-23T07:31:31Z")

</div>

Hi George, which plugin do you use to calculate those formulas?

---

<div class="post-metadata">

**Author:** ![georgecollier](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/georgecollier/32/182327_2.png) [@georgecollier](https://forum.bubble.io/u/georgecollier)\
**Post date:** [October 23, 2023, 7:48am UTC](https://forum.bubble.io/t/reapeating-group-best-practices-and-challange/289236/11 "2023-10-23T07:48:47Z")

</div>

None, the expression composer
