Trying to display my list in order by date

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.


This is the page that creates and inputs the entries into dictionary.

testproject (3).aia (10.5 KB)

Thank you!!

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.

See

23fc38d67d87c204329c33568a7dc2035fda50a9_2_538x500

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.

Here are revised blocks to allow sorted ListView Elements by underlying TinyDB value

The Clock Milliseconds from 1970 value is sort-friendly, so add it to the dictionary for each event, under a new tag.


Close up:

Building the ListView Elements list requires more work, broken up here into value procedures for flexibility:

Overview:

testproject3 (1).aia (11.8 KB)