A field holds a tiddler, which has a second field. Can you sort on the second field?

So I have a set tiddlers for make believe months - fantasy world. One tiddler for each month. Each has a field davout_month_order which is the order the month occurs in the year. I have events. One tiddler for each event. Each has the fields: davout_month, which has the name of the month, and davout_day, which has the day number.

So now I want to have a list of events in chronological order.

Maybe I should have stored the month number rather than name in davout_month, but then every time I want to display the date of the event in words (which would be the default), I would have to do some index thing. I don’t which would be better.

Is this possible?

Thanks.

Here’s some example code that demonstrates various sorting strategies.

by title:<br>
<$list filter="[has[davout_month]]">
   {{!!davout_month}} {{!!davout_day}} = <<currentTiddler>><br>
</$list>
<hr>
by day number:<br>
<$list filter="[has[davout_month]nsort[davout_day]]">
   {{!!davout_month}} {{!!davout_day}} = <<currentTiddler>><br>
</$list>
<hr>
by month number:<br>
<$list filter="[has[davout_month]] :sort:integer[{!!davout_month}get[davout_month_order]]">
   {{!!davout_month}} {{!!davout_day}} = <<currentTiddler>><br>
</$list>
<hr>
by month number and day number:<br>
<$list filter="[has[davout_month]nsort[davout_day]] :sort:integer[{!!davout_month}get[davout_month_order]]">
   {{!!davout_month}} {{!!davout_day}} = <<currentTiddler>><br>
</$list>

Notes:

  • Since you didn’t indicate if any tags are being used to identify the “event tiddlers”, I’ve used [has[davout_month] to find all the events.
  • The first example (“by title”) simply lists the events in default order (by event tiddler title)
  • The second example (“by day number”) uses the nsort[davout_day] filter operator to numerically sort the events in ascending order by day number without regard for the month
  • The third example (“by month number”) uses the :sort:integer[...] filter run prefix to lookup the davout_month_order value for the !!davout_month field of each event and then sort by the month order value in ascending order without regard for the day number value
  • The fourth example (“by month number and day number”) combines example #2 and example #3. This achieves your desired result.

Let me know how it goes…

enjoy,
-e

1 Like

Yes I have tag Event. I just replaced [has[davout_month] with [tag[Event] and it worked as desired.

Thanks so much.