List task-tiddlers in order of priority

I haven´t found a smooth way to do this yet, maybe someone can point me into a new direction.

I use my tiddlywiki-setup as a task managment system. Each task is represented as a tiddler with tag “Task”. These task tiddlers can have an additional tag, representing a priority.

This priority tag also exists as a tiddler, which is further tagged with “Priority”. The level of urgency of this priority tag/tiddler is represented in the list-field of the “Priority” tiddler.

So the structure looks something like this:

Task Tiddlers:

Tiddler: Task1
Tags: Task

Tiddler: Task2
Tags: Task, Prio2

Tiddler: Task3
Tags: Task, Prio1

Priority Tiddlers:

Tiddler: Prio1
Tags: Priority

Tiddler: Prio2
Tags: Priority

Literal Priority Tiddler:

Tiddler: Priority
List: Prio1, Prio2

Now my question: Is there a smooth way to display all Task Tiddlers in the order of their associated priority? So that a list-widget with its result would look like this:

Widget: <$list filter="""[tag[Task]]""" />
Result: Task3, Task2, Task1

My current approach is this one. The problem is, that it doesn´t show Tasks without priority:

<$list filter="""[tag[Priority]]""" variable=currentPrio>
<$list filter="""[tag[Task]] :filter[tags[]tag[Priority]compare:string:eq<currentPrio>]""" />
</$list>

Thank you for your help!

Try this:

<$list filter="[tag[Task]] :sort[tags[]tag[Priority]else[Prio999]sortby{Priority!!list}]"/>

The :sort[...] filter run prefix sorts the list based on the filter it contains.
In this example, that filter run gets the “PrioNNN” tag for each Task tiddler, using a fallback of “Prio999” if the Task tiddler has no “PrioNNN” tag. It then sorts by the order of “PrioNNN” tags as listed in the “list” field of the “Priority” tiddler.

2 Likes

Thank you for your quick response!

I tried, but unfortunatelly it doesn´t seem to work. One thing I found in the Tiddlywiki documentation for the " Sort Filter Run Prefix" is, that it needs a type-suffix?

But even if I add one, I tried all of them, it doesn´t seem to do anything. The filter you suggested for the sort prefix only seems to return the Priority tag itself, but ideally it should return some kind of order number?

Or do I understand something wrong…