Displaying statistics

Is there a less verbose way to pull this off? I want a tiddler with a simple table of stats, a count of how many tiddlers have a certain tag, a count of how many tiddlers pass or fail a regex, etc. This is what I have currently:

|Total lexicon entries|<$count filter="[tag[lexicon]]"/>|
|Entries needing review|<$count filter="[tag[check]]" />|
|Prefixes|<$count filter="[tag[lexicon]search:title:regexp[.*-$]]" />|
|Suffixes|<$count filter="[tag[lexicon]search:title:regexp[^-.*]]" />|
|Multi-word phrases|<$count filter="[tag[lexicon]search:title:regexp[\s]]" />|

Also, how do I get a math operator expression to display as regular text and not the link to a nonexistent tiddler whose title is a number?

I’ve tried setting this up as a data tiddler (seems like that makes the most sense.

totalEntries: [tag[lexicon]count[]]

and so on, but that just displays the raw text of the filter without evaluating it.

Hi @farspeaker

You could define some functions in a $:/tags/Global tagged tiddler of its own, and only call these functions inside the table.

Here is an example for your 1st counter:

Function definition:

\function lexicon.count() [tag[lexicon]count[]]

Function call:

|Total lexicon entries|<<lexicon.count>>|

Added benefit of functions: they display as normal text, so no need to call them inside a <$text> widget!

Hope this helps,

Fred

1 Like

Here’s what I came up with, more or less. I don’t think I’ll be needing to reference these stats elsewhere so I defined the functions at the start of the tiddler.

\function totalEntries() [tag[lexicon]count[]]
\function needReview() [tag[check]count[]]
\function prefixes() [tag[lexicon]search:title:regexp[.*-$]count[]]
\function suffixes() [tag[lexicon]search:title:regexp[^-.*]count[]]
\function phrases() [tag[lexicon]search:title:regexp[\s]count[]]
\function lexemes() [tag[lexicon]!search:title:regexp[\s]!search:title:regexp[-]count[]]

|Total lexicon entries|<<totalEntries>>|
|Entries needing review|<<needReview>>|
|Prefixes|<<prefixes>>|
|Suffixes|<<suffixes>>|
|Multi-word phrases|<<phrases>>|
|Lexemes|<<lexemes>>|
1 Like

another option is to use the $text widget:

<$text text={{{  [[2]multiply[5]]  }}} />
1 Like