How to list all tiddlers with at least the tags of the current one?

132 views
Skip to first unread message

Uwe

unread,
Aug 22, 2018, 10:37:14 AM8/22/18
to TiddlyWiki
Assume, I have a tiddler named "Tiddler1" with the tags "one" "two" and "three". How can I list all the Tiddlers which have at least the tags of this "Tiddler1"?

I'd like to use it in such a filter:

<$list filter="[!is[system]tag[FW]has[uw-inf]] +[sort[uw-inf]]">
<tr>
<td>{{!!uw-inf}}</td>

<td><$link>{{!!title}}</$link></td>
<td>{{||$:/core/ui/ViewTemplate/tags}}</td>
</tr>
</$list>

(I'm wondering, why this questions hasn't asked before.)

Greetings,

Uwe


Jed Carty

unread,
Aug 22, 2018, 11:19:44 AM8/22/18
to TiddlyWiki
This is one of the weaknesses of tiddlywiki that I still can't articulate well enough to make a solution. There isn't a straight forward way to combine multiple filters into a single list inside a list widget, but that isn't a good way to describe the problem.

That said, if you just want the list this works but may contain duplicates:

<$list filter='[[Some Title]tags[]]'>
<$list filter='[tag
<currentTiddler>]'>
{{!!title}} has at least one of the same tags as [[
Some Title]]
</$list>
</$list>

Uwe

unread,
Aug 22, 2018, 12:42:55 PM8/22/18
to TiddlyWiki
Thank you for your attempt to solve the problem. Your solution helps people who like to see at least one of the given tags in the result. But in my case, I need all of the tags of the tiddler [[Some Title]] to be found. (Some of the found tiddlers may have more than only these tags.)

This is what I made with your help, so far:

>Zeige alle Tiddler, die zumindest einen der Tags dieses Tiddlers enthalten. Kann Duplikate enthalten.
<table>
<$list filter='[[versuch]tags[]]'>
<$list filter='[!is[system]tag<currentTiddler>]'><br>
<!-- {{!!title}} hat zumindest einen der Tags des Tiddlers [[versuch]] -->

<tr>
<td>{{!!uw-inf}}</td>
<td><$link>{{!!title}}</$link></td>
<td>{{||$:/core/ui/ViewTemplate/tags}}</td>
</tr>
</$list>
</$list>
</table>

Jed Carty

unread,
Aug 22, 2018, 1:10:56 PM8/22/18
to TiddlyWiki
oh, sorry, I misread your original post. I am not aware of a reasonable way to do that.

Mark S.

unread,
Aug 22, 2018, 1:44:52 PM8/22/18
to TiddlyWiki
If I understand correctly, you want to look for OTHER tiddlers that have ALL the tags of the current tiddler ?

So if the current tiddler had tags A, B, C, you would want to find all tiddlers that also had tags A, B, C (and maybe some others).

Using wikify, it's possible to to create a filter string equivalent to tag[A]tag[B]tag[C] and then search by that. This seems to work:

\define gluefilter() [$(filtertext)$]
\define maketagitem() tag[$(tag)$]
\define alltagsfilter() <$list filter="[all[current]tags[]]" variable="tag"><<maketagitem>></$list>

<$wikify name="filtertext" text="<<alltagsfilter>>">

<$list filter=<<gluefilter>>>

</$list>
</
$wikify>

Good luck!

-- Mark

Uwe

unread,
Aug 22, 2018, 3:05:14 PM8/22/18
to TiddlyWiki
Thank you very much, that is the solution!

The only thing that I see is that there is an error message "Filter Fehler: Missing [ in filter expression"

when there is no tag assigned.

TonyM

unread,
Aug 23, 2018, 1:42:58 AM8/23/18
to TiddlyWiki
UWE,

I build a solution that suites my way of thinking. I do not have the same test data as you but I had this working with a different prefix and suffix

\define tags-here-filter(prefix suffix) $prefix$<$list filter={{!!tags}} variable=tag-here>tag[<<tag-here>>]</$list>$suffix$

<$wikify name=filter text="""<<tags-here-filter "[!is[system]" "has[uw-inf]] +[sort[uw-inf]]">>""">
<$list filter=<<filter>> >

</$list>
</
$wikify>

Regards
Tony

Uwe

unread,
Aug 23, 2018, 3:22:34 AM8/23/18
to TiddlyWiki
Thanks for your solution, it works great!

Here you see the usefullness of your work:

The given Tags "Aktuell" and "Q6" show me all Tiddlers, which have at least these tags.
Below the table with the matching Tiddlers, I can chose (or un-chose) the tags.


oneormoretags.jpg

This is the working source (only for two tags, because the list is looooong.)

\define tags-here-filter(prefix suffix) $prefix$<$list filter={{!!tags}} variable=tag-here>tag[<<tag-here>>]</$list>$suffix$

<$wikify name=filter text="""<<tags-here-filter "[!is[system]" "has[uw-inf]] +[sort[uw-inf]]">>""">
<table>
<tr>
<th>Titel</th><th>Tags</th>
</tr>
<$list filter=<<filter>>>
<tr>
<td><$link>{{!!title}}</
$link></td>

<td>{{||$:/core/ui/ViewTemplate/tags}}</td>
</tr>
</
$list>
</table>
</
$wikify>




<$fieldmangler>
 
<$list filter="[is[current]tag[KA01]]">
   
<$button class="button" message="tm-remove-tag" param="KA01">{{check}}<<tag KA01>></$button>
 
</$list>
  <$list filter="[is[current]!tag[KA01]]">
    <$button class="button" message="tm-add-tag" param="KA01"><<tag KA01>></
$button>
 
</$list>
</
$fieldmangler>
<$fieldmangler>
 
<$list filter="[is[current]tag[KA02]]">
   
<$button class="button" message="tm-remove-tag" param="KA02">{{check}}<<tag KA02>></$button>
 
</$list>
  <$list filter="[is[current]!tag[KA02]]">
    <$button class="button" message="tm-add-tag" param="KA02"><<tag KA02>></
$button>
 
</$list>
</
$fieldmangler>




Hope, that helps others which have a similar problem.

Again, thanks to all contributors!

Uwe

---

TonyM

unread,
Aug 23, 2018, 4:11:36 AM8/23/18
to tiddl...@googlegroups.com
Uwe,

Great to hear. 

One point I forgot to make is the tag field is a field like any other so it can be addressed as {{!!tags}} as I did in the solution I provided. It tends to slip peoples mind because tag handling is quite extensive, and we rarely refer to them that way. Also when I used filter={{!!tags}} I am using the whole of the tags field as the filter.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages