How to show only childless tiddlers in a tag hierarchy?

Say, I have a tag USA.

Tiddlers tagged with USA are

  1. California
  2. New York
  3. Texas

Tiddlers tagged with Calirfornia are

  1. San Francisco
  2. Los Angeles

“New York” and “Texas” are not used to tag any tiddler.

USA
├── California
│   ├── San Francisco
│   └── Los Angeles
├── New York
└── Texas

Now which filter can I use to show me tiddlers tagged with USA, and they do not have any descendants. In the given example, these would be, New York and Texas.

This question is related to Filter to return tiddlers tagged with the parent and all the child tags.

This is my solution. I am sure gurus here will post even a better solution.

[tag[USA]]-[tag[USA]tagging[]tags[]]

[tag[USA]tagging[]tags[] only shows those tiddlers that are child of “USA” and have descendants of their own.

Using -, I create a set which excludes the tiddlers with descendents.

My Demo

https://random-2023-06-16-1686938295.tiddlyhost.com/

You could try this approach:

[tag[USA]] :filter[tagging[]count[]match[0]]

2 Likes

Once thing to keep in mind with this kind of problem is to seperate the logic that generates the tree from the display of the result.