\define test()
<$list filter="[[_data]getindex[$(matching_indexes)$]]" variable="dataTiddler">
<$set name=arguments value=<<dataTiddler>>>
<<test2>>
</$set>
</$list>
\end
\define test2()
<<formula "sum(($(arguments)$), 5)">>
\end
<$set name=matching_indexes value=searchterm>
<<test>>
</$set>
hubertgk, When you say "sum that with 5" I presumed you mean add 5 to the single number found for each item in your output list, because you are calling Test2 every items. I think if I understand correctly You need to divide the problem into two steps. One sum the value of each list item together then two add 5 to the total. To do this you will need a variable outside of the list to accrues the values of the items inside the list. I have not done this yet, but I need to do this for another piece of work so I will provide a solution sooner or later. Counting or adding values from lists or field in sets of tiddlers should be a basic and accessible function in TiddlyWiki and it would be good if it did not need additional plugins. Regards Tony |
eg;
(= sum([tag[Expenses]get[value]]) =)
so perhaps this would work to return the number
(= sum([[_data]getindex[$(matching_indexes)$]])+5 =)
Notice the +5 is outside the sum
\define count-items(filter) <$list filter="$filter$ +[count[]]" variable=result><<result>></$list>
\define sum-field(fieldname,filter)
<$set name=filter value="$filter$" emptyValue="[has:field[$fieldname$]]">
(= sum([has[$fieldname$]] +[get[$fieldname$]]) =)
</$set>
\end
hubertgk Since I went down this line for myself I created the following two macros you can place in a tiddler tagged $:/tags/Macro | Regards Tony |