[tw5] sort tiddlers based on the output of a macro applied to each of them

Hi,

A filter outputs tiddlers x, y, z and I want to sort them.
Not by their title or by any field, but by the output of a macro applied to each of them, in my case a macro that returns the breadcrumbs of a tiddler.

Example of desired sorted output for tiddlers x y and z:
path > to > y
qath > to > too > tooo > z
rath > za > ze > x
(which is sorted alphabetically by breadcrumbs, and not by tiddlers titles)

I first thought I’d run two list loops :

  • first one assigns the breadcrumbs value of the tiddlers in a dedicated field in that tiddler
  • second one outputs the field : …get[dedicated_field]sort[] , and done !

Unfortunately I don’t know the mechanism to write the first loop.
Is it possible ?

Best,
E.

The conversation here has moved to https://talk.tiddlywiki.org/. Could you repost the question there, where it’s much more likely to get answers?

In the meantime, you might look up the sortsub operator (https://tiddlywiki.com/#sortsub%20Operator), which should allow you to avoid adding such temporary fields, sorting tiddlers based on the result of calling a subfillter… which can call your macro or procedure.

You may have a look at the trails plugin: BC & Trails — Breadcrumbs & Trails Visualize your Context
-Mario

Hi Mario,

This is indeed the plugin I am using to generate the breadcrumbs.

What I was wondering is : how to sort elements by a function output (here: trail / breadcrumbs applied to filter output) instead of by title or by any field of a filter output, the latter being what sort[] is made for.

Hope it makes sense :slight_smile:

@scott: I’ve seen you’ve moved the question to https://talk.tiddlywiki.org/, thanks !

@scott: I’ve seen you’ve moved the question to https://talk.tiddlywiki.org/, thanks !

Not quite. Things in the Google Group are copied to the forum. But it’s read-only there, and no one can respond, except back here inside Google Groups. Many people won’t bother, even if they know how to do so.

That’s why I encourage you to create a topic there.

– Scott