Add or sum number from fields tiddler by filter

104 views
Skip to first unread message

Sylvain Naudin

unread,
Jan 24, 2021, 6:11:33 AM1/24/21
to TiddlyWiki
Hi,

I searched this morning what exists to simply add (sum up) several numbers includes in fields from several tiddlers, but I'm not sure I found it (or how to implement it).

My need: via a tiddler filter with tag, add the numbers of a custom field contained in the tiddlers: in order to be able to count the time spent on a project.

A simple trick for the moment would suit me well, in sum the result would be 1+2+0,5+2+etc... = final counter.

Thank you for your help.
Have a good day,
Sylvain

Saq Imtiaz

unread,
Jan 24, 2021, 6:32:58 AM1/24/21
to TiddlyWiki

Sylvain Naudin

unread,
Jan 24, 2021, 6:39:32 AM1/24/21
to TiddlyWiki
Thanks Saq,

It sounds good indeed !

Eric Shulman

unread,
Jan 24, 2021, 8:52:09 AM1/24/21
to TiddlyWiki
On Sunday, January 24, 2021 at 3:11:33 AM UTC-8 sil...@gmail.com wrote:
My need: via a tiddler filter with tag, add the numbers of a custom field contained in the tiddlers: in order to be able to count the time spent on a project.

This will do the trick:
total = {{{ [tag[projectname]get[fieldname]sum[]] }}}

* change "projectname" and "fieldname" to match your usage

enjoy,
-e

Sylvain Naudin

unread,
Jan 24, 2021, 2:04:35 PM1/24/21
to TiddlyWiki
Hello Eric,

Thanks for this, since it's simple than reduce operator.
To not have link in result I've found this but I wonder if there is a simpler solution (or make a macro of it to choose its tag for example) :

<$set name="time" value={{{ [tag[entretien]get[duree]sum[]] }}}>
Total = ''<$text text=<<time>>/>''
</$set>


Otherwise after looking at the reduce Operator documentation, well I don't know how to implement it... There are some examples, but they are not complete enough for me to fully understand how to use it.. (because need to define other macro but not clear for me).


Cheers,
Sylvain

Eric Shulman

unread,
Jan 24, 2021, 2:47:35 PM1/24/21
to TiddlyWiki
On Sunday, January 24, 2021 at 11:04:35 AM UTC-8 sil...@gmail.com wrote:
To not have link in result I've found this but I wonder if there is a simpler solution

You can use the "filtered transclusion" syntax directly in the $text widget, like this:
Total = ''<$text text={{{[tag[entretien]get[duree]sum[]]}}}/>''

-e
Reply all
Reply to author
Forward
0 new messages