Trouble with nested lists, variables, prefix operator

72 views
Skip to first unread message

Brian Radspinner

unread,
Apr 19, 2021, 4:52:48 PM4/19/21
to TiddlyWiki

Hello all,

I am trying to get a nested timeline of Journal entries. Each Journal tiddler title starts with the prefix "YYY-0MM-0DD/" (example: 2021-04-19/Walking). For each day, there is also an empty tiddler titled with the format "YYY-0MM-0DD" (example: 2021-04-19). These
"day" tiddlers also have a "year" and "month" field (example: year=2021, month=-4).

I am trying to get a nested timeline list using the fields to break out the year & months, then finally display a list of transcluded entries for each year-month combo. So far I have the below code:
----------------------------
\define combo() $(getCombo)$

<$set name="getCombo" value="""<<year>>-<<month>>""" >

<$list filter="[tag[Journal]has:field[year]each[year]get[year]!nsort[title]]" variable="year">
   <$tiddler tiddler=<<year>>>
      <<year>><br/>
      <$list filter="[prefix<year>has:field[month]each[month]get[month]!nsort[title]]" variable="month">
         <$tiddler tiddler=<<month>>>
               {{!!title}}<br/>
               <<combo>> | <$list filter="[tag[Journal]prefix<combo>]">{{!!title}}</$list>
         </$tiddler><hr/>
      </$list>
   </$tiddler><br/><br/>
</$list>

</$set>
----------------------------

Everything works great until the line <<combo>> | <$list filter="[tag[Journal]prefix<combo>]">{{!!title}}</$list>. Outside the list, the <<combo>> variable properly displays, but inside the list <combo> is (maybe) not working. I am getting an empty list instead a list of tiddler titles prefixed with the <<year>>-<<month>> variables.

Any suggestions?

Thanks

Mark S.

unread,
Apr 19, 2021, 5:14:30 PM4/19/21
to TiddlyWiki
The combo variable isn't being rendered and then passed to the list filter as you might imagine. It's being rendered right there in place, and the filter is getting the literal text.

Try getting rid of the <$set> widget and replacing the text in the middle with:

<$vars combo={{{ [<year>]addsuffix[-]addsuffix<month>] }}} >
<<combo>> | <$list filter="[tag[Journal]prefix<combo>]">{{!!title}}</$list>
</$vars>

I'm not sure if the nested bit with the <$tiddler tiddler=year> widget is necessary.

Brian Radspinner

unread,
Apr 19, 2021, 7:17:52 PM4/19/21
to TiddlyWiki
Perfect! That worked. Thank you very much Mark.

TW Tones

unread,
Apr 20, 2021, 1:14:08 AM4/20/21
to TiddlyWiki
You can also wrap the list with a Wikify, although I like Marks solution better.

See how I reuse the variable name;

<$wikify name=combo text="<<combo>>">
<<combo>> | <$list filter="[tag[Journal]prefix<combo>]">{{!!title}}</$list>
</$wikfy>


PS in your Question you refer to YYY not YYYY but I doubt its important here.

Regards
Tones
Reply all
Reply to author
Forward
0 new messages