Filtering on "subtags"

132 views
Skip to first unread message

Steven Schneider

unread,
Jul 8, 2019, 2:55:48 PM7/8/19
to TiddlyWiki
Hi everyone, I sense that others' have asked but I can't quickly find in the group:

How would I filter on a tiddler being a "subtag." For example, if I had tiddlers for each species in the animal genus Canis I'd have tiddlers tagged "Canis" titled Canis mesomelas, Canis lupus, Canis latrans

How would I create a filter to capture species, effectively capturing tiddlers that are tagged to one of the tiddlers tagged to tiddler "Genus"

?

Thanks, 


//steve.

Mat

unread,
Jul 8, 2019, 3:48:01 PM7/8/19
to TiddlyWiki
Grandchildren

Here's one way

<$list filter="[tag[Granny]]" variable=granny>
<$list filter="[tag
<granny>]">


</$list>
</$list>


<:-)

Steven Schneider

unread,
Jul 8, 2019, 7:15:28 PM7/8/19
to TiddlyWiki
Mat, thanks. 

How do I put that filter into a template using [is[current]...


//steve.

Mat

unread,
Jul 8, 2019, 7:40:50 PM7/8/19
to TiddlyWiki
How do I put that filter into a template using [is[current]...

Are you saying you want a template for all tiddlers to show all grandchildren of the current tiddler? Then you don't need any "[is[current]]" in the template.

If you have a condition, like that it's only for animal tids or specifically for canis tids, you do this:

tags: $:/tags/ViewTemplate
text
:
<$list filter="[is[current]tag[canis]]" variable=granny>
<$list filter="[tag<granny>tag[canis]]" variable=parent>
<$list filter="[tag
<parent>tag[canis]]">


</$list></$list>
</$list>


You could get fancier with parents as headlines for the children etc.

<:-)

Mat

unread,
Jul 8, 2019, 7:42:51 PM7/8/19
to TiddlyWiki
Ah, triple quotes if you want to be sure not to break anything just because some animal has a " is its name.

<:-)

Xavier Cazin

unread,
Jul 9, 2019, 5:59:07 AM7/9/19
to tiddl...@googlegroups.com
Hi Steve,

What about using the tagging operator like so: [tag[Canis]tagging[]] ?

Cheers,
-- Xavier Cazin


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c19cd84a-7383-4721-b9ea-cc61ef8f9ab6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Schneider

unread,
Jul 9, 2019, 12:32:29 PM7/9/19
to TiddlyWiki
Ah, I clearly need to explain better.

I have parent tiddlers: A, B, C, D, etc. each tagged "parent"

I have child tiddlers: A1, B1, C2, D2, etc. (they are not tagged "child", but are tagged with the name of the parent tiddler

I need to have a template to manage the presentation of child tiddlers, but don't know how to write a filter that will capture any tiddler that is a child of any of the parent tiddlers, without specifying or knowing the name of the parent tiddlers.

So neither Xavier's nor Mat's approach works because I don't know the name of the parent tiddler, and there is nothing about the tiddlers other than the fact that each is tagged to a tiddler that is tagged "parent"...

<$list filter="[is[current] (tagged to  a tiddler that is a parent) ]]">



On Tuesday, July 9, 2019 at 5:59:07 AM UTC-4, Xavier wrote:
Hi Steve,

What about using the tagging operator like so: [tag[Canis]tagging[]] ?

Cheers,
-- Xavier Cazin


On Mon, Jul 8, 2019 at 8:55 PM Steven Schneider <st...@sunypoly.edu> wrote:
Hi everyone, I sense that others' have asked but I can't quickly find in the group:

How would I filter on a tiddler being a "subtag." For example, if I had tiddlers for each species in the animal genus Canis I'd have tiddlers tagged "Canis" titled Canis mesomelas, Canis lupus, Canis latrans

How would I create a filter to capture species, effectively capturing tiddlers that are tagged to one of the tiddlers tagged to tiddler "Genus"

?

Thanks, 


//steve.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.

Mat

unread,
Jul 9, 2019, 1:00:15 PM7/9/19
to TiddlyWiki
Maybe

<$set name=current value=<<currentTiddler>>>
<$list filter="[is[current]tags[]tag[parent]" variable=parent>
<$list filter="[
<current>tag<parent>]">
This is a child
</$list>
</$list>
</$set>

<:-)

Jeremy Ruston

unread,
Jul 9, 2019, 5:17:08 PM7/9/19
to tiddl...@googlegroups.com
Hi Steve

Ah, I clearly need to explain better.

I have parent tiddlers: A, B, C, D, etc. each tagged "parent"

I have child tiddlers: A1, B1, C2, D2, etc. (they are not tagged "child", but are tagged with the name of the parent tiddler

I need to have a template to manage the presentation of child tiddlers, but don't know how to write a filter that will capture any tiddler that is a child of any of the parent tiddlers, without specifying or knowing the name of the parent tiddlers.

OK, so this is intended to be a view template segment that is activated for these child tiddlers? 

If so, the following filter can be used to determine whether the current tiddler is tagged with a tag that is itself tagged with “parent”:

[<currentTiddler>] -[tag[parent]tagging[]]

The filter will return an empty result set if the current tiddler is tagged by a tiddler tagged “parent”. So, you should be able to do something like this within your view template segment:

<$list filter="[<currentTiddler>] -[tag[parent]tagging[]]" emptyMessage={{$:/_MyTemplateForChildTiddlers}} variable="ignore"/>

Then, in $:/_MyTemplateForChildTiddlers you’d have the template that is only displayed for tiddlers tagged by tiddlers tagged “parent”.

Best wishes

Jeremy


So neither Xavier's nor Mat's approach works because I don't know the name of the parent tiddler, and there is nothing about the tiddlers other than the fact that each is tagged to a tiddler that is tagged "parent"...

<$list filter="[is[current] (tagged to  a tiddler that is a parent) ]]">



On Tuesday, July 9, 2019 at 5:59:07 AM UTC-4, Xavier wrote:
Hi Steve,

What about using the tagging operator like so: [tag[Canis]tagging[]] ?

Cheers,
-- Xavier Cazin


On Mon, Jul 8, 2019 at 8:55 PM Steven Schneider <st...@sunypoly.edu> wrote:
Hi everyone, I sense that others' have asked but I can't quickly find in the group:

How would I filter on a tiddler being a "subtag." For example, if I had tiddlers for each species in the animal genus Canis I'd have tiddlers tagged "Canis" titled Canis mesomelas, Canis lupus, Canis latrans

How would I create a filter to capture species, effectively capturing tiddlers that are tagged to one of the tiddlers tagged to tiddler "Genus"

?

Thanks, 


//steve.


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c19cd84a-7383-4721-b9ea-cc61ef8f9ab6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Steven Schneider

unread,
Jul 10, 2019, 5:30:57 PM7/10/19
to TiddlyWiki
Yes! (with one small correction: needed another ] on the first $list line).

Thanks, Mat. (And thanks Jeremy; I'll look at your solution next :)

Mohammad

unread,
Jul 11, 2019, 2:02:55 AM7/11/19
to TiddlyWiki

Template tiddler

The below code shows a conditional view template tiddler. You can create a tiddler and tagged it with $:/tags/ViewTemplate


<$list filter="[is[current]tags[]]">
<$list filter="[
<currentTiddler>tag[parent]]">
 This is a child!
</$list>
</$list>

Mohammad

unread,
Jul 11, 2019, 2:20:25 AM7/11/19
to TiddlyWiki
Added to TW-Scripts as

A Two Way Conditional View Template


TW-Scripts/Scripts%20in%20TW%205.1.20-pre.html#A%20Two%20Way%20Conditional%20View%20Template
Hi Steve

Reply all
Reply to author
Forward
0 new messages