Getting a count in a list?

97 views
Skip to first unread message

leeand00

unread,
Nov 28, 2016, 2:17:33 PM11/28/16
to TiddlyWiki
\define thisList()
<!-- BEGIN: Loop Through a list of tiddlers matching $(thefilter)$ -->
<$list filter="$(thefilter)$">
 
<!-- For Each Item...count the number of tiddlers tagged with it.. -->
 
<$view field="title"/> - <$count filter=[tag[!!{{title}}]] /> <br/>
</$list>
\end


<$set name="thefilter" value={{!!dasfilter}}>
<<thisList>>
</
$set>


Is it possible to do this?  The part that really has me confused is how to get a <$count> that will count the number of tiddlers tagged with the current tag.

As for the data, lets say I had the following:

tiddler tags: red, blue, green
tiddler: tags

apple: tags: red, green
water: tags: blue
sky: tags: blue
ball: red, blue, green
grass: tags: grass

Then it would output:

red - 2
blue - 3
green - 3

I just want to count how many tiddlers within a specific set of tags are tagged with that tag.  But I don't want ALL OF THEM like in the tag manager.

Jed Carty

unread,
Nov 28, 2016, 3:26:59 PM11/28/16
to TiddlyWiki
I think that all you need to do is fix the filter in the count widget. It should be 

<$count filter=[tag{!!title}] />

Jon

unread,
Nov 28, 2016, 3:29:33 PM11/28/16
to TiddlyWiki
Hi,

this gives a list of all tags and a count of each.

<$list filter="[tags[]!is[system]sort[title]]">
<$transclude tiddler="$:/core/ui/TagTemplate"/> <small class="tc-menu-list-count"><$count filter="[all[current]tagging[]]"/></small>
</$list>

I don't know if there's anything here you can adapt.

Regards
Jon

Jon

unread,
Nov 29, 2016, 1:08:13 AM11/29/16
to tiddl...@googlegroups.com
Jed's reply arrived just before mine - go with his suggestion!
Reply all
Reply to author
Forward
0 new messages