Hi, it appears that several people are having issues with sorting their queries:
Sort next tasks query in reverse order (upcoming -> future)
Query to produce events in chronological order for current page only
Simple Query Sort-By does not work
Advance Query - Sort by latest update datetime
Sorting a query by block order on page?
Separate query result sorting logic from result transform - #2 by douglascamata
Sort deadline query chronologically
Sort NEXT queries by block/journal-day
It seems that there are two main problems
- Sorting produces inconsistent results
- Formatting and information is lost after a result transform, for me the journal page dates disappearing is the biggest issue.
I have been banging my head against this problem for a long time now and have trialled and errorred my way though 100s of advanced queries trying to solve the issue. I am not a coder and have got nowhere, but I have an idea
Logseq databases contain all of their pages as simple text files in the
journals directories. I had thought about using a script to run through these files and extract and sort the information I need. However, Logseq’s folder structure sometimes gets nested and complicated. Also, many variables I might like to use in my search like
block/properties etc. might not be available or might be tricky for a script to obtain.
What about this as a solution.
1. First do a query or advanced query from Logseq
1.1 This could be done from a page created only for this purpose so there is not extra information from entries above and below the query
2. Then run a script on the resulting file to put it in the correct order
2.1 I am not capable of doing this myself, but I believe it would not be difficult in
python for example.
2.2 Later, this could be made into an Plugin, or perhaps incorporated into an existing plugin such as @adxsoft’s one which works online, or can be found on github. as a Logseq Plugin.
Is this feasible?
If so, can anyone show me how to do it?
Or is there another way to solve the issue?
Either way, I think this function ought to be there and it looks like it would help a lot of people and not just me.