[Help Request] List of tiddlers with only one particular tag

90 views
Skip to first unread message

Rene

unread,
Jun 18, 2018, 6:30:19 AM6/18/18
to tiddl...@googlegroups.com
Hello.  

Apologies if this is asked/answered but I did do a search and didn't see anything on this.

My question is if there is a way to generate a list of tiddlers which are tagged with only one particular tag.

My use-case is when embedding lists in a tiddler using 

<<list-links filter:"[tag[particular_tag]]">>

and wanting the returned list to exclude tiddlers with any other tag (even if they are also tagged with "particular_tag").

Many thanks for any help!

TonyM

unread,
Jun 18, 2018, 9:46:01 AM6/18/18
to TiddlyWiki
If you still need help in 12 hours I will give you a solution but remember tags are stored in the tags field so if the whole fields value is = your single tag it will be only tagged with your single tag and nothing else.

Regards
Tony

Mark S.

unread,
Jun 18, 2018, 10:24:34 AM6/18/18
to TiddlyWiki
You can do this leveraging filter Runs to apply some Boolean logic. Or maybe illogic.

For simplicity, I'm using "TagA" as the name of the tag.

Find:

all tiddlers tagged with TagA

From those, subtract the following group

find all tiddlers with TagA
find all tags in those tiddlers, removing TagA
find all tiddlers tagged by those tiddlers
subtract this group

Here's what I have, tested very briefly on TiddlyWiki.com:

<<list-links "[tag[TagA]] -[tag[TagA]tags[]!title[TagA]tagging[]]">>

Change TagA to you tag name of course. Hopefully I haven't made any logic errors, but it's easy to overlook something, so test around a bit.

Good luck!

-- Mark

TonyM

unread,
Jun 18, 2018, 8:20:44 PM6/18/18
to TiddlyWiki
Rene,

I used this as an exercise and came up with this short macro.

<$list filter="[tag[$intag$]]">
First it lists all tiddlers tagged with your target tag "one" in this example inside the first <$list
With no variable set on the list statement this will change the current tiddler value

<$list filter="[is[current]get[tags]prefix[$intag$]suffix[$intag$]]" variable=null>
Then the second list gets the value in the tags field of the current tiddler (ie all tags)
And asks it to list only a tags field beginning with the target tag and ending with the target tag.
This list uses the variable null so current tiddler remains as set by the first <$list as a result {{!!title}} refers to the tiddler title in the first list that passed the test in the second list.

Macro in same tiddler or tagged $:/tags/Macro 
\define showonlytagged(intag)
<$list filter="[tag[$intag$]]">
 
<$list filter="[is[current]get[tags]prefix[$intag$]suffix[$intag$]]" variable=null>
 
{{!!title}} Tagged "$intag$" only<br>
</$list>
\end

Execute
<<showonlytagged "one">>


Mark,

It has not gone unnoticed by me we are both often endeavouring to solve the same problem for people and offering some times quite different solutions, however I want to point out I am getting great value from it. I think of it as diverse input and collaboration rather than competitive, but I hope we continue.

Regards
Tony

Rene

unread,
Jun 18, 2018, 9:08:28 PM6/18/18
to TiddlyWiki
@TonyM and @MarkS

Thank you both very much for responding!  I will be honest and say that I ended up trying and using Mark's method, because it was a simple one-liner and it worked on first try.  A thousand pardons TonyM, but for a person who struggles with code I jumped on the simpler solution.

And yes interaction among users can only benefit the community; do please keep doing what you guys do!

Many thanks again!

- Rene


On Monday, June 18, 2018 at 10:24:34 PM UTC+8, Mark S. wrote:
You can do this leveraging filter Runs to apply some Boolean logic. Or maybe illogic.

For simplicity, I'm using "TagA" as the name of the tag.

Find:

all tiddlers tagged with TagA

From those, subtract the following group

find all tiddlers with TagA 
find all tags in those tiddlers, removing TagA
find all tiddlers tagged by those tiddlers
subtract this group 

Here's what I have, tested very briefly on TiddlyWiki.com:

<<list-links "[tag[TagA]] -[tag[TagA]tags[]!title[TagA]tagging[]]">>

Change TagA to you tag name of course. Hopefully I haven't made any logic errors, but it's easy to overlook something, so test around a bit.

Good luck!

-- Mark


Rene

unread,
Jun 18, 2018, 9:10:32 PM6/18/18
to TiddlyWiki
Marked "Best Answer"
by Question Asker


On Monday, June 18, 2018 at 10:24:34 PM UTC+8, Mark S. wrote:

TonyM

unread,
Jun 18, 2018, 9:16:47 PM6/18/18
to TiddlyWiki
Rene,

No ego here to bother. But of course we in effect answered two different questions. I am glad you found one that suits.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages