Great feature!
Thank you Jeremy

On Saturday, April 25, 2020 at 3:02:57 PM UTC+4:30, Jeremy Ruston wrote:
>
> I’ve now implemented a new “subsort” filter that takes a subfilter and 
> sorts the incoming titles by the result of running that filter on each one 
> in turn:
>
>
> https://github.com/Jermolene/TiddlyWiki5/commit/619c0752bd3c6e71d1fcdb74daa03cfe8257afe4
>
> The OP should be achievable using a subfilter such as:
>
> [{!!value}divide{!!time}]
>
> With that filter in a variable called “cost” it could be used like this:
>
> [tag[tas]subsort:number<cost>]
>

Seems it is sortsub

Using tiddlywiki.com I made a test as below 

\define cost() [{!!value}divide{!!time}]
<$list filter="[tag[job]sortsub:number<cost>]">

</$list>

but it does not work! Please advise!


> The new operator will be available on https://tiddlywiki.com/prelease in 
> a few minutes (you can check on build progress here: 
> https://travis-ci.org/github/Jermolene/TiddlyWiki5/builds)
>
> Best wishes
>
> Jeremy
>
>
> On 23 Apr 2020, at 16:46, si <matthew...@gmail.com <javascript:>> wrote:
>
>
> Thank you so much Eric you have saved me yet again! I really appreciate 
> you taking the time to help me out.
>
> On Wednesday, 22 April 2020 23:22:31 UTC+1, Eric Shulman wrote:
>>
>> On Wednesday, April 22, 2020 at 11:30:41 AM UTC-7, si wrote:
>>>
>>> Hi everyone.
>>> I'm trying to implement a particular type of task list using plain 
>>> wikitext. I stole the idea from supermemo 
>>> <https://supermemo.guru/wiki/Tasklist>.
>>> Each of my tasks is tagged *task*, and has the fields *time *and *value*. 
>>> These fields represent the estimated time a task will take and the 
>>> perceived value of a task respectively.
>>> I'm trying to generate a task list that is sorted by the result of *value 
>>> divided by time* for each task.
>>> I thought this would be able to do this easily, then tried it and 
>>> realised I couldn't. Can anyone help me out here?
>>>
>>
>> I did something similar to create a "tag cloud", where the tags are 
>> sorted by the number of tiddlers they are tagging.
>> See 
>> http://tiddlytools.com/filtergenerators.html#TiddlyTools%2FFilterGenerators%2FTagCloud
>>
>> For your purposes, the code is actually quite a bit simpler than the 
>> TagCloud.  This should do the job:
>> \define getitems()
>> <$list filter="[tag[task]]">
>>    <$vars time={{!!time}} value={{!!value}}>
>>    <$text text="[["/>{{{ [<value>divide<time>divide[10000]] }}};<<
>> currentTiddler>><$text text="]]"/>
>>    </$vars>
>> </$list>
>> \end
>>
>> <$wikify name="items"  text=<<getitems>>  >
>>    <$list filter="[enlist<items>nsort[]]">
>>       {{{ [<currentTiddler>split[;]last[]] }}}<br>
>>    </$list>
>> </$wikify>
>>
>> The <<getitems>> macro:
>> * gets all tiddlers tagged with "task"
>> * calculates the "value/time" number for each and divides it by 10000 to 
>> ensure that all numbers are zero-padded for proper sorting (so a value, 
>> e.g., "15" is not sorted between "1" and "2")
>> * prepends that calculated value in front of each task title, separated 
>> by a semi-colon (;) and surrounded by double square brackets to handle 
>> titles with spaces
>>
>> The calling code:
>> * Uses $wikify to capture the output of <<getitems>> into a variable, 
>> "items"
>> * The $list widget then enlists the items and sorts them numerically
>> * The output then strips off the calculated number and the semi-colon 
>> separator and displays the tiddler titles in the sorted order
>>
>> Let me know how it goes...
>>
>> enjoy,
>> -e
>>
>>
>>
> -- 
> 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 tiddl...@googlegroups.com <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/37d4d40b-ce4f-44ad-b2a0-8a4217ebf502%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/37d4d40b-ce4f-44ad-b2a0-8a4217ebf502%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/448ba5f8-80db-4443-8eaa-8131dd60e2b9%40googlegroups.com.

Reply via email to