[TW5] Doubts about how to get a $count to a $list

270 views
Skip to first unread message

Juan P. Garcia

unread,
Oct 11, 2016, 12:44:46 PM10/11/16
to TiddlyWiki
Hello everyone!

I'm new to TiddlyWiki, I've been doing my research, learning and having a lot of fun with it.
I decided to make a catalog of TV series I've watched using TiddlyWiki, but now I have some doubts about how to do something that I'd say it should be easy, but I'm stuck.

My tiddler structure goes like this:
  • I have a tiddler for each series. I have tagged them with [series], a tag for the season (Summer, Winter, Spring, Fall), and a tag for the year (the actual number for the year).
  • I have created a tiddler for each season. I have tagged them with [season], a tag for the season, and another for the year number.
  • I created a tiddler for each year. I have tagged them with [year], and a tag for the year number.
  • The home tiddler contains a $list like this:

<ul>
<$list filter="[tag[year]]">
<li><$link><<currentTiddler>></$link> <small class="tc-menu-list-count">(<$count filter="[all[current]tagging[]tag[series]]"/>)</small></li>
</$list>
</ul>

It is working properly, as it is.


However, in the tiddler for each year, I would like to get a list of seasons for that year, however, I'm stuck as in how to get it working. This is my attempt at it.


<ul>
<$list filter="[tag[season]tag[2016]]">
<li><$link><<currentTiddler>></$link> <small class="tc-menu-list-count">(<$count filter="[all[current]tagging[]tag[series]]"/>)</small></li>
</$list>
</ul>

It isn't working at all, it always shows a count of 0.

Any ideas on how could I make it work? Even if I have to change the tagging system, I would love to get that count.


Thank you all.



Mark S.

unread,
Oct 11, 2016, 1:44:41 PM10/11/16
to TiddlyWiki
I think that having tiddlers that are tagged with their own name is going to cause problems, but I digress.

I think we need to see your data -- my quick experiment showed a non-zero count. Do you have your series labeled, "Fall", for example?

I don't think the filter is going to give you what you want though. It's going to generate a list of seasons [[Fall]] [[Winter]] [[Spring]] [[Summer]] (unless 2016 has less than 4 seasons) and then there is going to be a count for all series that aired in those seasons (no matter what year). So you need to have the year in the count filter as well.

Good luck!
Mark

Juan P. Garcia

unread,
Oct 11, 2016, 3:05:28 PM10/11/16
to TiddlyWiki
Hello Mark.

Thanks for your prompt reply.
Sorry for the confusion with the square brackets, the name of the tags doesn't include that.

I posted my (incomplete) TiddlyWiki in this URL: http://tamani.me/Anime.html
You can navigate to 2016, and click on Winter 2016 to see an example of what I wanted to do.
There I left the basic $list command, along with the experimental $list + $count that doesn't work.

The series are tagged "series", the year and the season. In example, the tags for a particular series would be "series", "Winter", "2016".
A season can be tagged as "season", "Winter", "2016".
A year can be tagged as "year", "2016".

The only tiddlers that are tagged with their own names are the years.

Any insights on this will be great.

Mark S.

unread,
Oct 11, 2016, 3:42:57 PM10/11/16
to TiddlyWiki
Ok, I believe the filter you want is:

"[all[current]tags[]tagging[]tag[series]]"

"all[current]" grabs the current tiddler generated in the outer filter (e.g. 2016-1 Winter)

"tags[]" turns the tiddler into the tags it has (e.g. 2016, season,  winter)

"tagging[]" finds all the tiddlers that are tagged with 2016, season, winter.

"tag[series]" limits the result to just those that are marked as series

Good luck!
Mark




Juan P. Garcia

unread,
Oct 11, 2016, 4:06:00 PM10/11/16
to TiddlyWiki
Wow, now I get a non-zero count! Progress!

Now it is searching by filtering with each one of the tags in the current tiddler, so it is returning every tiddler that has the "2016" or "Winter" or "season" tags, so it is lumping all the series that have the "Winter" tag, no regards for the year tag as well.

I think I know of a way to remove a tag from a filter (to remove "season"), but how could I turn this filter an "all tags or nothing" (an AND based filter) one?

You have been really helpful, I'm loving this thing a lot.

Mark S.

unread,
Oct 11, 2016, 5:52:45 PM10/11/16
to TiddlyWiki
I figured it had to be wrong, but I wasn't about to count 200+ entries to find out!

For simplicity, I switched to working with 2005.

What you can do is add a year and a season field to each of your seasons. (e.g. season=Fall and year=2005 for "2005-3 Fall").

Then this code should get you the right counts. Maybe:

<ul>
<$list filter="[tag[season]tag[2005]]">
<li><$link><<currentTiddler>></$link>
<small class="tc-menu-list-count">

(<$count filter="[tag{!!year}tag{!!season}tag[series]] "/>
)
</small></li>
</$list>
</ul>


HTH
Mark

Juan P. Garcia

unread,
Oct 11, 2016, 8:28:24 PM10/11/16
to TiddlyWiki
Thanks Mark, that is an elegant solution to my ordeal.

It is working perfectly now.
Reply all
Reply to author
Forward
0 new messages