mathematics operators add field values

49 views
Skip to first unread message

Dave

unread,
Dec 29, 2019, 11:47:53 PM12/29/19
to TiddlyWiki
I have a tiddler named "math example" with two fields: "one" = 7 and "two" = 8

if I put this in the filter part of the advanced search field
[tag[math example]get[text]length[]sum[]]

it gives the result "18" because the text in them (2 tiddlers tagged "math example") is "bla bla" and "bla bla bla" respectively (7 and 11 characters long)

but how would I get  a sum of the two fields in that original tiddler?

if I do this:
[title[math example]get[two]sum[]]

it returns "8" and likewise "7" for "get[one]"

but this doesn't work at all:
[title[math example]get[two]get[one]sum[]]


Is what I'm trying to do possible with just the normal TW5 tools?
(version 5.1.21)  I also tried putting a "+" between them and also starting both with "=" (i.e. ...=get[one]=get[two]...)

Eric Shulman

unread,
Dec 30, 2019, 12:09:31 AM12/30/19
to TiddlyWiki
You need to retrieve each field value in a separate filter run... then use sum[] to add them:
[title[math example]get[one]] [title[math example]get[two]] +[sum[]]

enjoy,
-e

 

Dave

unread,
Dec 30, 2019, 12:45:21 AM12/30/19
to TiddlyWiki
Ok, cool. Thanks Eric!
Reply all
Reply to author
Forward
0 new messages