In my Kansas Railroad wiki, I have a tiddler to display all the values for the field statefiled along with how many railroads are associated with that statefiled value. The code is below:
What I would like to do and can’t quite put my finger on how to do it is to sort this output from high to low. For example, Kansas would be first, followed by Missouri, then Oklahoma, etc. I can’t help but think there is a slick way of doing this, but I’m not coming up with it. (Note: the Missing State row is separate and not included in this question.)
I think [tag[Railroads]] should be stored into a variable with set-widget filter parameter since it is used 4 times in different filters. IMO it should be reused.
[tag[Railroads]] is the shortcut for [all[tiddlers]tag[Railroad]]
The count widget is very heavy. So if performance becomes a problem it should be optimized too, which will be tricky. I do not have a solution atm
The code worked great as written. Interstingly, if I took out all[tiddlers] from the myCount definition, it reverted back to the previous behavior. Not sure why.
Some operators are behaving like subfilters applied to their input, just like if the subfilter was starting by all[current]. I’ve read this somewhere in the forum, but can’t remember where… nor can I remember the list of operators behaving this way. At least subfilter and sortsub do IIRC.
So if you remove all[tiddlers] from myCount, everything works as if myCount was: [<StateFiled>tag[Railroads]statefiled<currentTiddler>count[]] which gives an empty result (or 0) for each value of StateFiled.