Counting question

Hello fellow Tiddlywikians.

I have a TW that I’m using to organize my tobacco and soda card collections. These cards typically come in sets of some number and I have a tiddler for each of these sets tagged Set. Any card that belongs to that set is tagged with that set as well as tagged with Card. The set has a field for the number of cards that were issued in that set. By counting the number of tiddlers tagged with any given set, I can determine whether or not the set is complete by comparing to the issued field. That’s easy.

What I am struggling with is coming up with a way to determine the total number of sets across my collection that are complete and the total number of sets that are not complete. I’m sure there’s a relatively simple way of doing this, but my mind is not cooperating this weekend. Any help would be greatly appreciated.

I might not be understanding the question, since it seems like you have all the bits you need:

!!! Full Sets:
<$list filter="[tag[Set]]:filter[all[tiddlers]tag<currentTiddler>count[]compare:number:eq{!!issued}]+[count[]]" >

</$list>
!!! Incomplete Sets:
<$list filter="[tag[Set]]:filter[all[tiddlers]tag<currentTiddler>count[]compare:number:ne{!!issued}]+[count[]]" >

</$list>

image

3 Likes

Try this:

<$list filter="[tag[Set]]">
   <$link/>: <$count filter="[tag{!!title}]"/> out of {{!!issued}}
   (<$text text={{{ [{!!title}tagging[]count[]match{!!issued}then[complete]else[incomplete]] }}}/>)<br>
</$list>

There are
<$count filter="[tag[Set]] :filter[{!!title}tagging[]count[]!match{!!issued}]"/>
incomplete sets and
<$count filter="[tag[Set]] :filter[{!!title}tagging[]count[]match{!!issued}]"/>
complete sets.

-e

3 Likes

Thanks @EricShulman and @Mark_S . Both of you understood what I was asking. I have ended up using both solutions (or slight tweaks thereof). Screenshot below:

I definitely need to use the filter operator more often. I didn’t even think about that. Enlightening as always. Much appreciated.

1 Like

WOW, Very nice looking wiki!
Congrats!

Thanks! It’s been a lot of fun and is still a work in progress. Most of the work involves getting the rest of my collection in it.

1 Like