Dynalist formulas


#1

Hi all. I’ve hacked up something that somebody may find useful. It’s a tampermonkey userscript that does two things:

  1. It lets you show a count of the number of instances of any visible tag
    Eg to count instances of a tag called #cat use #count(#cat)

  2. It lets you show a total of a value referenced by any visible tag in the format #someval=x
    Eg use #legs=4 #legs=3 #sum(#legs) to count 7 legs


Raw gist is here (for installing in tampermonkey)
Source code here

Notes/Disclaimer/Bugs:
I’m not a jquery expert, it’s probably buggy. Any suggestions/bug reports welcome.
The code runs a loop once a second. Performance should be OK, but may be slow if there are hundreds of visible tags.
Sum is integer only just now
Content in notes gets counted/summed if parent node is visible
Node being edited doesn’t get counted/summed
Formatting around the formula works (ie you can bold/italic etc the summed value)