the tiddlers in the first column are sorted in order of their list of tag pills
<$button>Sort Tags
<$list filter='[!is[system]]'>
<$set name=TagsString filter='[<currentTiddler>tags[]sort[]]'>
<$action-setfield tags=<<TagsString>>/>
</$set>
</$list>
</$button>
"[<currentTiddler>tags[]sort[]]".
In my other example about sorting tags by the number
of times they are used, the "sub-filter" would be "[<currentTiddler>tagging[]]".
<currentTiddler>tags[]sort[]]]"<currentTiddler>tagging[]]]"--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/6eceb037-a36d-429d-be81-ff5d2b5355c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Steve I think that your use case is interesting because it shows a limitation of sorting with TW filters (although imho in this specific case the best solution would be to sort the list of tags automatically every time a tag is added to a tiddler).
I think another case with the same limitation is when one wants to sort a list of tiddlers by the number of times they are used as tags (i.e. number of tiddlers tagged with them).
...
I wonder if it would be possible to implement new "sort" filter operators which would allow the usage of a sub-filter like this
<$vars sortfilter="[<currentTiddler>tagging[]]">
<<list-links filter:"[all[]sortby<sortfilter>]">>
</$vars><<list-links filter:"[all[]sortby:nsort<sortfilter>]">><$vars sortfilter="[<currentTiddler>tagging[]count[]]">
<<list-links filter:"[tags[]sortby<sortfilter>]">>
</$vars>Hi Erwan,Steve I think that your use case is interesting because it shows a limitation of sorting with TW filters (although imho in this specific case the best solution would be to sort the list of tags automatically every time a tag is added to a tiddler).
I think TiddlyWiki should *never* sort a list-field when adding or removing an item, unless specifically instructed to do so via something like Matabele's listops, the tags field being just a special case of a generic list-field.I think another case with the same limitation is when one wants to sort a list of tiddlers by the number of times they are used as tags (i.e. number of tiddlers tagged with them)....I wonder if it would be possible to implement new "sort" filter operators which would allow the usage of a sub-filter like this
This sounds to me that -- for the purposes of sorting -- we wish for something like a "virtual field", by which we can sort after we've created it "in-memory". A sortby filter could "sort by the output of filter expression evaluated against an item". This filter expression could be passed to the operand as either a variable or text reference as we'd have no other way to chuck a "subfilter" within a filter expression, e.g.
<$vars sortfilter="[<currentTiddler>tagging[]]">
<<list-links filter:"[all[]sortby<sortfilter>]">>
</$vars>
'The above should cater for the OP's requirement, assuming the sortby filter would:
- evaluate each item in the input set against the specified filter in the operand
- sort the items in the input set with respect to whatever was returned
It could / perhaps should even be...
<<list-links filter:"[all[]sortby:nsort<sortfilter>]">>
...to avail any core sorting algorithms.
The count would be:
<$vars sortfilter="[<currentTiddler>tagging[]count[]]">
<<list-links filter:"[all[]sortby<sortfilter>]">>
</$vars>
...requiring, well, a nonexisting "count" filter.
Best wishes,
Tobias.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/0fd70eb7-1315-4e10-aff7-37ba9bd6af23%40googlegroups.com.
Yes, thank you Tobias for understanding and formalizing my idea!
Should we open an issue about that?
{{{ [sort:eval<sortfilter>] }}}{{{ [sortcs:eval<sortfilter>] }}}Jed: The button solution you suggested work fine (see listing below).
Hi Erwan,Yes, thank you Tobias for understanding and formalizing my idea!
Should we open an issue about that?
I think we should, but let's go one more round beforehand, perhaps.
Now I'm beginning to think that it should not be a filter of its own but rather a flag (/suffix) to any available sort filter that instructs it to sort by the evaluated operand, e.g.:
{{{ [sort:eval<sortfilter>] }}}
In other words:
Sort the input elements by the output of evaluating the specified operand as a filter expression.
Equivalently:
{{{ [sortcs:eval<sortfilter>] }}}
etc...
Not sure if an "evaluated operand" would be relevant for other filter operations other than sorting and whether we could / should devise a syntax that always does evaluation, no matter what filter operator.
Best wishes,
— tb
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a6d40057-9187-4b10-bb6f-7fb9dc52502f%40googlegroups.com.
Hi Erwan,Yes, thank you Tobias for understanding and formalizing my idea!
Should we open an issue about that?
I think we should, but let's go one more round beforehand, perhaps.
Now I'm beginning to think that it should not be a filter of its own but rather a flag (/suffix) to any available sort filter that instructs it to sort by the evaluated operand, e.g.:
{{{ [sort:eval<sortfilter>] }}}
In other words:
Sort the input elements by the output of evaluating the specified operand as a filter expression.
Equivalently:
{{{ [sortcs:eval<sortfilter>] }}}
etc...
Not sure if an "evaluated operand" would be relevant for other filter operations other than sorting and whether we could / should devise a syntax that always does evaluation, no matter what filter operator.
Best wishes,
— tb
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a6d40057-9187-4b10-bb6f-7fb9dc52502f%40googlegroups.com.