Convert list into multiple lists starting with letter

How can we convert a long list into multiple smaller lists starting with each alphabet letter? Example:

This would be helpful for creating an index for better user experience in navigating long-lists.

Use list sorting blocks, or test each list item with text blocks to see which letter it starts with, then assign to appropriate list - then use list sorting blocks (or extension)

Have a go, and report back on progress/success

You could try this approach for faster lookup …

You could also try the new dict data type, one letter per key, 26 keys per dict, and hang more subdicts as values, for 26-wide tree lookup, with your words at the twigs of the tree.
This would require a first time setup (slow), but you might be able to save the whole structure after it’s built and reload at startup.

You could also build up the dict as you query, one branch at a time, as needed. That would spread out the build time.

you might want to work with the local sqlite database... much easier to sort, filter, etc...
see for example

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Thanks, will try playing around to see what works well and runs in decent time. Will definitely share, too!

Still a beginner at programming… Don’t understand dictionaries yet, but will look into this. The idea of faster-load times and faster ways of sorting information is very intriguing.

Thanks for the suggestion. Currently querying a GoogleSheets URL to use like a free database.

Will need to add more items to the list later while the app is in-use.

Unsure whether it would be faster to sort on GoogleSheets first…

Filtering upstream on Googles' Sheets server should be faster, if you use the SQL-like Sheets query language.

See FAQ Section: Google Sheets

what about using this method?

Taifun

Yes, this is the query language being used. Thanks!

Finished! Here are the blocks:

And here is a recorded demo of this functionality:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.