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

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

Hello Eric,

Download the attached and drag it into TiddlyWiki.com.

Cheers !

TiddlersAtoE.json (1.14 KB)

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={{{ [tags[]sort[]join[,]] }}} >

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

</$vars>

‘‘Same exact tags as this tiddler + other tags if any:’’

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

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

</$vars>

Thanks again,
Eric