How? Eliminating gaps in sequential numbering between records

Hi there, sorry if this is an obvious question; I’m still very new to Adalo and I wasn’t able to find something similar in the forums already.

Let’s say I want to have a number of records in the same table each have a different sequential number but I want the gap to close when one of those records gets deleted, how would I go about doing that? For instance…

If I wanted to create a waitlist that draws from a “Users” collection with a “Position” property. I’d use {max position+1} to set each new user’s position:

User, position
A, 1
B, 2
C, 3
D, 4
E, 5
F, 6
G, 7

Now say user C drops off the list and that row is deleted (or otherwise filtered out, depending on what will work best here), I would like to be able to run an operation that would be able to identify the gap and cause the record for D to update to 3; E to become 4; F → 5, and G → 6. After that, if a new record gets added, let’s say user H, their position would be 7 (which is now the new {max+1}.

Is there a user-end-friendly way to do this without using an external service?

Thanks so much for any help on this. I know it’s niche but I’ve already seen so many clever workarounds in the forum that I’m crossing my finders someone has one for this too!

Hi Mary,

It would be good to know the scenario in which this would be used and then we could work out the best way to address it.

Thanks
Craig

Hi Craig, Thanks for jumping in! Let’s use a scenario of a waitlist with different people on it who are given a unique ordinal ranking that gets entered into their record (rather than just appearing on a bulleted list that gets updated live).

So let’s say we have:

Smith, 1
Devi, 2
Garcia, 3
Li, 4
Jones, 5
Singh, 6
Brown, 7
Tremblay, 8

And then let’s say that Jones takes themself off the waitlist and the record gets deleted from the collection (or otherwise rendered inactive with a true/false property, if that works better for whatever solution we come up with).

The rankings for Smith through Li should stay the same, but Singh through Tremblay should each move up in ranking so that the collection is now.

Smith, 1
Devi, 2
Garcia, 3
Li, 4
Jones
Singh, 5
Brown, 6
Tremblay, 7

It doesn’t matter to me what screens we use to make this happen, so I have no constraints there or screenshots to include or anything. Just so long as I can re-number the records. Also, this doesn’t need to happen for all of the records in the collection. It can just be the top 25 or top 100 if there’s no quick way to do it for a larger collection and so managing the number of records that are affected would be important to mitigating run-time.

The hardest part, from my own vantage point as I try to figure this out is in identifying the gap. If I could figure out the way to get the app to identify that there’s no #4 after Jones is removed, I could use a countdown timer method I saw elsewhere, if there’s no other solution, but I haven’t been able to wrap my head around how to do that yet.

Thanks again for jumping into it with me!!

Hi Mary,

If you were to take the visual number out of the equation in this instance and think just about a list. You could create a collection named ‘wishlist’. Add fields such as {order} number field, {name} text field or user join, {withdrawn} true/false field.

Now when you set an action, you can create a new wishlist record and set the {order} field as count+1 which will count the records and + 1. Then you can create a list of ‘wishlist’ and sort using the {order} field but don’t show the ‘order’ number on the list and exclude any records where the field is ‘withdrawn’ = true. Then if someone removes themselves from the list, set the ‘withdrawn’ field to true and the list will still be in the correct order even if the numbers skip.

I hope you understand what I am trying to say but if you need more clarification then I can maybe create an example for you to follow.

Cheers
Craig

Hi @Mary ,

Take a look at this post

This can be done in Adalo.

Sequence number is useful to identify who is below who and can be assigned to more actions.

Thanks for that explanation, Craig! (@crmorris2) Unfortunately, I’m looking for something that will allow a unique ordinal ranking that gets entered into the records, rather than just appearing sequentially ordered on a list. So that gets close, but it’s not quite there.

Thanks, @Yongki! That looks very like the feature I need to implement and I’m heading to take a deep dive into that thread to check it out now.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.