# Repeating group order

I’m using a repeating group that is sorted by a field we call “position”

The repeating group is sorted by “position”

We have 2 button that allows the user to move the repeating group position up or down.

What we are running into is when the position changes for that cell all the other cells should update as well so the order stays correct.

Any suggestions?

Hi Chris,
I just created a playlist of short videos for you as a lot of people ask about creating a list to order and then you have to find a way of making the ordering work.
As you seemed to have the backend right, below is video 3 of the series already.

Hope this solves your problem, if not pm me, happy to help
best regards
Julius

6 Likes

Hey @TipLister I appreciate the video! I actually have this part all done!

What we are running into more specifically is when we move a list item down it overlaps with another.

For example -
5 list items.

Position
1,2,3,4,5

I want list item 3 to be in position 2.

So the button is clicked to move the cell down.

now our database is
1,2,2,4,5

so when the page is reloaded the list loads weird. This gets really bad when things get moved around a lot.

You can end up with stuff like 1,1,1,3,5 or other crazy combinations. So the positions need to save ALL around not just the current cell.

We tried adding an action so the flow is:

Make changes to - “current cells” - “position” + or - 1
Make changes to a list of things - “current page (datatype)” - “position” - Current cell index

But realized it just over saved the current cell position rather than pulling each cells index.

also tried this flow:
Make changes to - “current cells” - “position” + or - 1
Make changes to a list of things - “current page (datatype)” - “position” - + or - 1
Make changes to - “current cells” - “position” + or - 1

So it counter weights so it would do (moving down)
1,2,3,4,5

ACTION 1:

3 turns to 2
so now you have
1,2,2,3,4

ACTION 2:
They all - 1
so now you have
0,1,1,3,4

ACTION 3
+1 of current cell
so you get
0,1,2,3,4

But when things get moved up and down a lot you can get very crazy numbers and negatives which is just sloppy in the DB and UI

Hi, I am sorry, I am not quite sure I understand.
Could you please make me a screenshot of a) The repeating group and its source and b) All workflow actions you have when you click the up button.

In the video 3 of my playlist, I never have something like 1,2,2,3,4, which you seem to have, turning up because of the conditionals I used.

DUDE YOU ARE AMAZING! THANK YOU!

I see what you where doing now! I’ve been on this for hours and it was such a simple solution! Thanks a ton!

Hello, I ran across this post and have one question: Will this workflow work when the repeating group is displaying a field list?

Consider this, I have a Data Type called ‘Event’. I have a thing called “Event Name”. My thing contains field lists that are groups of players. Example: Event Name ‘ABC Competition’ (the thing) has a Group1 field list which is …Tom, Dave, Jim, Pete, George; a Group2 field list which is … Greg, Alan, Mary, Kay, Bill… and so on.

Though I am able to properly display Group1 and Group2 field list values in repeating groups, I can’t build the workflow suggested in the video that allows me to re-order the individual names using the up and down arrows.

Thanks for any assistance. I’m really stuck on this one. If you need me to post a link to the app, let me know and I will be glad to do so.

Hi tom.love,

How are you displaying your names?
Ie do you have a repeating group showing events, and then inside 1 cell of that another repeating group showing names signed up for that event?
Then you could do the above. Just give the people numbers instead of the events.

Ahhh, I have a need to display all groups associated to only one event at a time. Prolly easiest if you just take a quick look at how I have things set up.

Is there a way to animate the process of replacing the position?

Hey thanks for the video! I was wondering if you could please share us the editor link to take a better look to your setup. Thanks

Hi, here you go

1 Like