Sort and Update Data Tables

What I’m trying to do:
I’ve seen several examples of data table sorting like:

results = app_tables.my_table.search(tables.order_by("Name"))

and this returns a sorted dictionary. However, I would like sorting to be updated to be reflected in app_tables.my_table and not just in the “results” return. I don’t want to have to call the sort function each time I want to display this table. Is there a better way to sort app_tables innately without having to rebuilt the table from the “results” dictionary?

Tables in a database don’t have a specific order. The contain data and you always need to specify the order.

Given that there is a SQL database underneath, probably not. By definition, SQL stores “relations” (hence “relational database”), and relations are by definition unordered.

That said, data in a file is ordered, physically. So if your data is not subject to change very often, see Anvil Docs | Data Files.

1 Like