Making and event list app. I have it so the user can create events and view a list of events. However they are listed in order that theyre created. Im trying to get my list to display in order of date. Each item in the list has a tag of date and title. I've trying creating a second global and doing a sort list function but I cant get it to work and the list comes back empty.
This is the page that displays the list of events.
Since dictionary tags are ordered in text sort order, as are TinyDB tags, a properly formed tag with a YYYYMMdd prefix should sort chronologically by default.
There is an alternative way to retrieve TinyDB contents and sort them.
Use the TinyDB block that retrieves the entire DB as a single dictionary, in this case a dictionary of dictionaries.
The VALUES dictionary block would give you a list of the values in the dictionary, each one an event dictionary.
Code a EventSORTKEY value procedure that extracts a sort key from an event dictionary. It would be a text JOIN of what you want to sort by, in major minor order, like start year, start month, start day, event title.
Use the advanced list sort block on the list of TinyDB values, using the EventSORTKEY value of each event for comparison.
Feed the sorted list of event dictionaries into a converter procedure to produce a list of ListView Elements , with readable Main Text parts and TinyDB tags in the detail parts.
Use the detail part of a Selected Element to look up the full event in TinyDB.