How do you reorder app data?

I’m trying to reorder the rows in my App Data database. I’m using a repeating group to represent a menu from this data base, and I have a new record that I want to add in the middle.

Given that the repeating group displays records in the same order that it’s in, in the database, I’m trying to figure out how to insert a record in the middle of the database.

Any help would be appreciated!

You can use the :sorted by operator to sort a list of things by any of its number/text/date properties. By default it sorts by Created Date.

To customize the order, I usually add a ‘Sort Order’ number field on the data type and manage the value of this field based on how I want it to be ordered.


A repeating group displays data in any order you tell it to.

Right, let’s say you have a sort order field that’s 1-10, if you have to insert something that’s #7, wouldn’t you have to renumber all the values after 7? Wouldn’t this get even worse if there a 100 entries?

In this case, when adding a new record you could define a specific order or leave it without defining an order. Then you could create workflows so that if you don’t define an order, then the record order would be last record order +1.

On the other hand, if an order was defined and a record already existed in the database with that order. So in the workflow you would take all the records whose order is equal to or greater than the defined order and add 1, then add the new record with the desired order.

That’s an interesting idea, thanks!

Yeah, that was going to be my last resort option. Was wondering if there was anything else I should be considering before adding decimals into the order value.