nesting list using field as filter

67 views
Skip to first unread message

Philippe Le Toquin

unread,
Nov 8, 2016, 6:16:32 PM11/8/16
to TiddlyWiki
Hello,

I am hitting my next wall. And again my lack of full understanding of TW is stopping me.

For my project I create a tiddler every day which which has a tag  and 2 fields week and year. The title is made up of the day of the week plus the week and year to make it unique

What I would like to achieve is to group them by year and each year would list all the weeks under it.

<$list filter="[!is[system]each[year]get[year]]" >
<br>
<h1><$view field=title /></h1>

   <$set name="thisyear" value={{!!title}} >
   <$list filter="[!is[system]year[<
<thisyear>>]]">
     <$link to={{!!week}}>Week <$view field=week />
<br></$link>
   </$list>
  </$set>
</$list>

That code list the year as expected but the next list is not printing anything. I think the problem is with either the $set or the  "year[<<thisyear>>] which is most likely not the correct syntax. I just can't work out how to do it the right way


Riz

unread,
Nov 8, 2016, 8:27:54 PM11/8/16
to TiddlyWiki
Hi Phillippe,
 

Well you nailed the problem correctly. "year[<<thisyear>>]" should be "year<thisyear>".
These two tiddlers will come handy when you code: http://tiddlywiki.com/#:%5B%5BFilter%20Parameter%5D%5D%20TextReference


Another thing to note is you do not need set widget here, unless there is more nesting. You have filtered out the year, which the system by default sets to a variable - currentTiddler. So your filters will look something like this

<$list filter="[each[year]get[year]]" >
<h1>{{!!title}}</h1>
<$list filter="[year<currentTiddler>each[week]]">

 <$link to={{!!week}}>Week <$view field=week/><br></$link>
</$list>
</$list>

Philippe Le Toquin

unread,
Nov 9, 2016, 7:09:15 AM11/9/16
to tiddl...@googlegroups.com

Thanks a lot Ritz. I had seen that page before but did not fully understand what it really meant. Now of course I do.

I ended up using your code in the end. One because it is much nicer and two because even with your input my code doesn't work and returns nothing

Not sure why.

Edit: I found out why. The value of the variable was in between spech mark. Once I removed them it all worked again :)
Reply all
Reply to author
Forward
0 new messages