Nested lists using tiddler titles as tags

360 views
Skip to first unread message

Ivan Aparicio

unread,
Nov 8, 2016, 6:48:17 AM11/8/16
to TiddlyWiki
I've been grappling with a problem for two days that I hope someone could help me with.

I have an application in which I'm trying to allocate home improvement tasks to different areas of the house, and split the tasks over the four quarters of the year. Essentially the breakdown is:

Quarter Area
Q1 Kitchen
Q2 Garden
Q3 Shed
Q4 Livingroom

Each task should have a tiddler and is laid out with tags for quarter and area as per the following example:

Title: Task1
Tags: Q1, Kitchen
Text: Replace the tiles in the kitchen

My ultimate goal is to have a tiddler for each quarter that brings the tasks together by transcluding the content of each tiddler under its relevant area, ie:

Title:Q1
Tags:Quarter
Text:
Kitchen

Replace the tiles in the kitchen

Sand down the counter top

Garden

Mow the lawn

Shed

Set up trampoline

Livingroom

I've set up the following nested filter:

<$set name=tiddler-title value={{!!title}}>

<<tiddler-title>>

<$list filter="[tag[Area]]">
<$link>''{{!!title}}<br>''</$link>
<$list filter="[tag<tiddler-title>]">

<$transclude mode="block"/>
</$list>
</$list>

</$set>

But the result is that all of the tiddlers are brought in, regardless of how they are tagged by quarter. Does anybody know why?

Jed Carty

unread,
Nov 8, 2016, 7:34:09 AM11/8/16
to TiddlyWiki
Your inner list isn't restricted to the results of the outer list, it is getting everything tagged with the title of the containing tiddler. You need to add tag<currentTiddler> to the inner list.

<$set name=tiddler-title value={{!!title}}>



<
<tiddler-title>>

<$list filter="[tag[Area]]">
<$link>''{{!!title}}
<br>
''</$link>
<$list filter="[tag
<currentTiddler>tag<tiddler-title>]">

Ivan Aparicio

unread,
Nov 8, 2016, 9:05:08 AM11/8/16
to TiddlyWiki
Thanks Jed, that works! I'm a bit confused though, should the value of currentTiddler and tiddler-title be the same?

Jed Carty

unread,
Nov 10, 2016, 4:52:10 AM11/10/16
to TiddlyWiki
Since it is inside a list widget the currentTiddler variable is set to the title of the current item in the list in the same way that {{!!title}} shows the title of the current list item, not the containing tiddler.

Ivan Aparicio

unread,
Nov 10, 2016, 9:10:34 AM11/10/16
to TiddlyWiki
That makes perfect sense now. Thanks Jed!

Ivan Aparicio

unread,
Nov 23, 2016, 4:34:08 AM11/23/16
to TiddlyWiki
I've been trying to make the an improvement; do you know how I could get the quarter tiddler to only display the areas for which there are tasks? I'm not sure how to put a conditional statement to trigger the line <$link>''{{!!title}}<br>''</$link>.


On Thursday, November 10, 2016 at 9:52:10 AM UTC, Jed Carty wrote:

Jed Carty

unread,
Nov 25, 2016, 9:25:12 AM11/25/16
to TiddlyWiki
The quick answer is that you put a list around it that returns one element when your conditional is true and nothing when it isn't. So something like this may work:

<$set name=tiddler-title value={{!!title}}>



<
<tiddler-title>
>

<$list filter="[tag[Area]]">
<$list filter="[tag
<currentTiddler>tag<tiddler-title>limit[1]]"><$link>''{{!!title}}<br>''</$link></$list>
<$list filter="[tag
<currentTiddler>tag<tiddler-title>]">


<$transclude mode="block"/>
</$list>
</$list>

</$set>

That will only show the link to the quarter if there is something listed under it.

Ivan Aparicio

unread,
Nov 29, 2016, 11:42:56 AM11/29/16
to TiddlyWiki
Thanks Jed, that does exactly what I wanted! I think I'm starting to get a hang of how to filter things in TW.
Reply all
Reply to author
Forward
0 new messages