filter question: which tiddler is newer

108 views
Skip to first unread message

Mohammad Rahmani

unread,
May 5, 2021, 1:41:37 AM5/5/21
to tiddl...@googlegroups.com
Back to winter 2019, when we were working on the Commander plugin we needed a comparison between two tiddlers to see which is greater. See [1]
The best solution we found (by BTC) at that time was as below [2] (still works and is part of Commander)


<$set name="tidBMod" value={{{ [[Bb]get[modified]] }}}>
<$set name="tidAMod" value={{{ [[Aa]get[modified]] }}}>
<$list filter="[<tidAMod>] [<tidBMod>] +[nsort[]last[1]removesuffix<tidAMod>]">
Yes, Aa is newer
</$list>
<$list filter="[<tidAMod>] [<tidBMod>] +[nsort[]last[1]removesuffix<tidBMod>]">
No, Aa is older
</$list>
</$set>
</$set>



With the advent of many new filter operator, I want to know if there is a shorter and more semantic solution can be found today Apr 2021

I thought about the below solution and it works in TW 5.1.23

<$vars dtb={{{[[Bb]get[modified]]}}}>

<$list filter="[[Aa]get[modified]compare:integer:gt<dtb>then[Aa]else[Bb]]">
<<currentTiddler>> is newer!
</$list>

</$vars>


But I am wondering if we could use :filter or some other operator to drop the $vars and dtb and perform the comparison in single $list
Note Aa and Bb are two tiddlers


Saq Imtiaz

unread,
May 5, 2021, 2:37:58 AM5/5/21
to TiddlyWiki
Does this do what you need?

Aa Bb +[nsort[modified]limit[1]]

Or try something like this in 5.1.24 pre-release:

Aa Bb :sort:date[get[modified]] +[limit[1]]

Mohammad Rahmani

unread,
May 5, 2021, 3:05:03 AM5/5/21
to tiddl...@googlegroups.com
Hi Saq,

Very clever! Both works!

On Wed, May 5, 2021 at 11:08 AM Saq Imtiaz <saq.i...@gmail.com> wrote:
Does this do what you need?

Aa Bb +[nsort[modified]limit[1]]


I am wondering why we did not try this which was available from 2015? ;-)

 
Or try something like this in 5.1.24 pre-release:

Aa Bb :sort:date[get[modified]] +[limit[1]]

Great! So, we can use the new named prefix :sort?
Is it possible to have multiple steps filter like below

filter1 :filter[step2]  :filter[step3]



 
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/918a183b-82d2-411e-8896-06315800770bn%40googlegroups.com.

TW Tones

unread,
May 5, 2021, 6:05:34 AM5/5/21
to TiddlyWiki
Or this;

<$list filter="[[ActionDeleteTiddlerWidget]] [[ActionListopsWidget]] +[!sort[modified]]">
   <$link/> {{!!modified}}<br>
</$list>

;Newer test
<$list filter="[[ActionDeleteTiddlerWidget]] [[ActionListopsWidget]] +[sort[modified]] +[last[]]">

</$list>
;Older test
<$list filter="[[ActionDeleteTiddlerWidget]] [[ActionListopsWidget]] +[sort[modified]] +[first[]]">

</$list>

Tones

TiddlyTweeter

unread,
May 5, 2021, 6:58:37 AM5/5/21
to TiddlyWiki
Mohammad wrote:
Back to winter 2019, when we were working on the Commander plugin ...

 I like how you used the "Royal WE" :-) (https://en.wikipedia.org/wiki/Royal_we)

Commander is brilliant! And basically YOU :-)

Best wishes
TT

Saq Imtiaz

unread,
May 5, 2021, 7:17:56 AM5/5/21
to TiddlyWiki
@Mohammad:
 
Great! So, we can use the new named prefix :sort?
Is it possible to have multiple steps filter like below

filter1 :filter[step2]  :filter[step3]


Yes multiple filter runs can be combined just as before (with +, ~ etc). Note that the input to each filter run is the output from the previous run. 

Mohammad Rahmani

unread,
May 5, 2021, 10:28:31 AM5/5/21
to tiddl...@googlegroups.com
Hi Josiah,

On Wed, May 5, 2021 at 3:28 PM TiddlyTweeter <Tiddly...@assays.tv> wrote:
Mohammad wrote:
Back to winter 2019, when we were working on the Commander plugin ...

 I like how you used the "Royal WE" :-) (https://en.wikipedia.org/wiki/Royal_we)

I laughed a lot on this! Very nice!

I remember how much people were kind to help to implement the Commander! You did a great job
on regex! See help/regular expression in https://kookma.github.io/TW-Commander/#%24%3A%2FCommander
which has been totally written by you!
Saq recently developed the Batch Edit button! Mark S did a lot of scripting part! and BTC macros and help will always be appreciated in developing SNR.
I remember Watt who did a lot of testing and read docs for English!

Commander is a real example developed by a group of people here!
We were working together at that time and I appreciate all their talent, time and kindness!


 

Commander is brilliant! And basically YOU :-)

:-) :-)

Thank you



 

Best wishes
TT

--
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.

Mohammad Rahmani

unread,
May 5, 2021, 10:29:16 AM5/5/21
to tiddl...@googlegroups.com
Thank you for clarification!

--
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.

Mohammad Rahmani

unread,
May 5, 2021, 10:30:38 AM5/5/21
to tiddl...@googlegroups.com
On Wed, May 5, 2021 at 2:35 PM TW Tones <anthony...@gmail.com> wrote:
Or this;

<$list filter="[[ActionDeleteTiddlerWidget]] [[ActionListopsWidget]] +[!sort[modified]]">
   <$link/> {{!!modified}}<br>
</$list>

;Newer test
<$list filter="[[ActionDeleteTiddlerWidget]] [[ActionListopsWidget]] +[sort[modified]] +[last[]]">

</$list>
;Older test
<$list filter="[[ActionDeleteTiddlerWidget]] [[ActionListopsWidget]] +[sort[modified]] +[first[]]">

</$list>

Tones

Thank you Tones! All works and are short!
Reply all
Reply to author
Forward
0 new messages