Numbering a series efficiently

Hi! I’d like ask about how to number the items in a slice without skips to produce something like this (shown in descending order):

3X_7_c_7cb10c53fbf4f6923873d2fd2305e347412a3288.png

The formula I’m using for the “No.” is as follows:

count(select(Kankaku[Word],[_RowNumber]<[_THISROW].[_RowNumber]))+1

The select function counts the number of items ([Word] is in all of the items so I used that but I could have used [Key] or something else) that have a lower row number and adds 1.

This works OK but generally speaking, using select expressions in this way is not considered to be a good practice. What I don’t understand is how to get around it. I could do the same thing on the spreadsheet side but that would create some latency for the user (new items would not be numbered immediately). I could just use the row numbers, but then I would have skips, which I prefer to avoid.

If I want consecutive numbering to be instantaneous and without skips, is my way the best method? It would seem that AppSheet should have some “inexpensive” (at sync time, that is) way of numbering.

1 7 218
7 REPLIES 7

Steve
Participant V

The way you’re doing it is the only way I can think to do it without actions (which wouldn’t be user-specific).

Thanks!

Because numbering is expensive, I decided to order the records in this table by date of creation.

I do have bunch of app with “numbering” such as serial / sequencial number Per table, or per group etc. But as discussed in the separete thread, dont employ VC as it get super heavy and expensive. Just run the action upon adding new row only. Need a trick.

MultiTech
Participant V

count(split(left(concatenate([Walkthrough_Link].[Walkthrough_Elements]), find([ElementID], concatenate([Walkthrough_Link].[Walkthrough_Elements])) + 7), " , “) - list(”"))

I’m pretty sure this would run WORSE than what you’ve already got, but in the app I built to make In-App Guides and Auto-Tables I’ve got this formula inside an action - to manually change the sort number of items in a list to their position inside that list.

(You see, I was having problems with the manual sort numbers being off from their actual position inside a list - so I needed a way to conform the manual sort numbers to their actual positions inside the list.)

So when you run the action: if item 1 is the first item in the list, it’s sort order is set to 1; if it’s number 34 in the list, then it’s sort number is set to 34.


I’m not sure if this would work inside a VC, and if you used it there I’m sure it would run like crap. But the general idea of this formula is as follows:

Bahbus
Participant V

Using the same thing but count within a category.
COUNT(SELECT(Flavors[Flavor_Name], AND([Flavor_Category]=[_THISROW].[Flavor_Category], [_ROWNUMBER]<[_THISROW].[_ROWNUMBER])))

And this is in a VC. Doesn’t seem to actually hurt my sync times as much as I thought it might.

To state the obvious, you can number things on the spreadsheet side too. I do that in one part of my app. If you delete a record, the renumbering won’t be instantaneous for the user but it will get done eventually without slowing down either the sync or the user experience.

Top Labels in this Space