returning all the tiddlers that contain at least the same tags as the current tiddler

31 views
Skip to first unread message

Eric N

unread,
Oct 17, 2021, 6:32:35 AMOct 17
to TiddlyWiki
Hi all,

I am looking for a way to select all the tiddlers that contain at least the same tags as the current tiddler.

Say the current tiddler contains tags A & B, and other tiddlers contain:
- C D E
- A D E
- B D E
- A B
- A B C D E,

the filter expression would return only the last two ones.

And the number of tags in the current tiddler may vary, so that cannot be hard coded in the filter expression.

Any idea ?

Best,
Eric

Charlie Veniot

unread,
Oct 17, 2021, 10:22:31 AMOct 17
to TiddlyWiki
Hello Eric,

Download the attached and drag it into TiddlyWiki.com.

Cheers !
TiddlersAtoE.json

Eric N

unread,
Oct 18, 2021, 1:27:23 AMOct 18
to TiddlyWiki
Hi,
Thank you so much !
Would have taken me weeks to figure it out by myself...

For the record for anyone wondering here is the code:

''Same exact tags as this tiddler:''

<$vars theseTags={{{ [<currentTiddler>tags[]sort[]join[,]] }}} >

<$list filter="[all[tiddlers]] :filter[tags[]sort[]join[,]match<theseTags>] +[!match<currentTiddler>]">
<$link/>
</$list>

</$vars>


''Same exact tags as this tiddler + other tags if any:''

<$vars theseTags={{{ [<currentTiddler>tags[]sort[]join[*]] }}} >

<$list filter="[all[tiddlers]] :filter[tags[]sort[]join[]regexp<theseTags>] +[!match<currentTiddler>]">
<$link/>
</$list>

</$vars>


Thanks again,
Eric
Reply all
Reply to author
Forward
0 new messages