Mark,

I am keen to see these macros you refer to can you tell me the tiddler 
names in http://carbocommander.tiddlyspot.com/ ?

Also, I would love to find a way to do sums without needing to bring in the 
formulas plugin as it is somewhat overkill.

I may put a request in for a sum[] filter operator that resembles the 
count[] filter operator.

Thank in advance



On Tuesday, June 19, 2018 at 2:15:13 AM UTC+10, Mark S. wrote:
>
> The SetWidget now has a filter option. I seem to recall that the output is 
> as an array. Perhaps you could replace the <$list> with a <$set> ?
>
> For CarboCommander (http://carbocommander.tiddlyspot.com/) I added a 
> couple macro's to Evan's kit to allow the aggregation of numbers into 
> variables. It may be klunky (you have to use 3 different macros to 
> initialize, accumulate, and report "variables" ) The variables in this case 
> refer to identifying strings rather than your usual TW variables.
>
> Good luck!
> -- Mark
>
> On Monday, June 18, 2018 at 8:54:10 AM UTC-7, hubertgk wrote:
>>
>> Hi,
>>
>> Using Evan Balster's <<formula>> macro, I'm trying to sum the numerical 
>> output of a <$list> filter but each of the list items is processed 
>> separately.
>>
>> For example, if the output of my list is 2 2 1 and I try to sum that with 
>> 5 using <<formula>>, then each of the arguments is summed in isolation and 
>> I get "7 7 6" (2+5, 2+5, 1+5) instead of "10" (2+2+1+5).
>>
>> So my question is, how can I transform the output of a list filter (all 
>> returned arguments) into a single array containing those arguments?
>>
>> Here's my code. I've provided more of it for context but it's not 
>> necessarily relevant to my question (I'm having a list of values returned 
>> based on a search performed on indexes in a data tiddler. The values are 
>> numbers and the output is a list).
>>
>> \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>
>>
>>
>> Thank you very much for your ideas!
>>
>> Best,
>>
>>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c2c739bb-291b-44ae-9664-cd60e077923b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to