Hello Dave, That is no trivial thing you're trying to do. Well, maybe somebody has a trivial solution.
But what a great "Brain Age" game !!!
So in the meantime, download the attached and drag into tiddlywiki.com to
import the tiddlers and give you an opportunity to study what I've done.
I've pasted the code below as reference for anything murky that needs some
serious explaining.
It is not a trivial affair to require dynamic identification of fields that
need to be summed.
Much easier to specify the exact fields. Then you have a simple filter
like "[get[aaa1]] [get[aaa2]] ... etc. ... [get[aaaX]] +[sum[]]"
Since we do not know the exact field names, then we have to dynamically
build that filter above. (As per the *highlighted magic* in the code below)
Ignoring the starting and ending "pre" tags. I'm trying that to see if the
code below shows up okay in TiddlyTalk (which is finicky with this kind of
stuff.)
<pre>
\define p1() [get[
\define p2() ]]
\define p3() +[sum[]]
<$list variable="thisField" filter="[fields[]regexp[aaa]]">
sum of <<thisField>> values:
<$list filter="[get<thisField>sum[]]">
{{!!title}}
</$list><br>
</$list>
*<$vars thisDynamicFilter={{{
[fields[]regexp[aaa]addprefix<p1>addsuffix<p2>] [<p3>] +[join[ ]] }}}>*
<$list filter={{{ *[<thisDynamicFilter>]* }}}>
''total:'' <<currentTiddler>>
</$list>
</$vars>
</pre>
On Wednesday, December 15, 2021 at 10:40:06 PM UTC-4 Dave Kor wrote:
> Hello, I am storing numeric data in tiddler fields and I'd like to select
> fields that start with lets say "aaa" and sum all their values together. I
> know I can use filters to select the fields i need using something like {{{
> [[Data]fields[]prefix[aaa]] }}} and I can probably sum their values
> together using the sum[] operator.
>
> However, I am stumped as to how I can get the field's value. I know the
> final filter would look something like {{{ =[[Data]fields[]prefix[aaa]???]
> +[sum[]] }}} I just do not know what operator to use to get the field
> values.
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/e867b554-ad7f-4024-89b6-18215d1b0c28n%40googlegroups.com.
SuperDuperSumming.json
Description: application/json

